aspnetcore: Add an option to disable DeveloperExceptionPageMiddleware with WebApplication / Minimal APIs
Is there an existing issue for this?
- I have searched the existing issues
Is your feature request related to a problem? Please describe the problem.
Hi, I want to have an option to disable preconfigured (implicit) middlewares and I can’t remove DeveloperExceptionPageMiddleware
/ (.UseDeveloperExceptionPage
call).
I don’t want to use WebHostBuilder
because according to the docs it’s deprecated:
This article covers the Web Host, which remains available only for backward compatibility. The ASP.NET Core templates create a WebApplicationBuilder and WebApplication, which is recommended for web apps.
I don’t want to wrap and catch with my middleware after the developer exception middleware, because it’s an ugly workaround and produces unnecessary allocations and useless work per request.
Describe the solution you’d like
Add an option to disable implicit middleware logic or at least have an option to disable .UseDeveloperExceptionPage
in Development
environment too.
Additional context
Hardcoded part of WebApplicationBuilder
:
https://stackoverflow.com/questions/69982014/how-to-not-use-developerexceptionpagemiddleware
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 1
- Comments: 15 (9 by maintainers)
The idea was to add CreateEmptyBuilder and that would replace the need for WebHostBuilder (we haven added that API yet)