WebApplicationFactory<TEntryPoint> will not allow Middleware to be added via the ConfigureWebHost() method and maintain the existing functionality from the TEntryPoint. #61170
Labels
area-mvc
Includes: MVC, Actions and Controllers, Localization, CORS, most templates
feature-mvc-testing
MVC testing package
Is there an existing issue for this?
Describe the bug
When attempting to use a CustomWebApplicationFactory, I wanted to add a Middleware to set some specific values to handle underlying HttpContext.
Started with this code returning a 200 - OK
I tried to jump to the simple middleware to ensure this would work with this code and it returned a 404 - Not Found
Someone in discussions suggested that I didn't need to pass the context, so i tried this code and it returned a 404 - Not Found
Ultimately, I tried to do a "No Operation" call to see if my code was breaking it; this code returned a 404 - Not Found.
Expected Behavior
Expected behavior is that the middleware configurations above would operate and return a 200 - OK by relying on the configuration provided by the TEntryPoint.
Steps To Reproduce
simple sample project provided by #53999
Additional troubleshooting in the discussion and documented above.
Exceptions (if any)
No response
.NET Version
8.0.302
Anything else?
No response
The text was updated successfully, but these errors were encountered: