aspnetcore/breaking-changes/5/middleware-exception-handler-throws-original-exception.md
Before ASP.NET Core 5.0, the Exception Handler Middleware executes the configured exception handler when an exception has occurred. If the exception handler, configured via xref:Microsoft.AspNetCore.Builder.ExceptionHandlerOptions.ExceptionHandlingPath, can't be found, an HTTP 404 response is produced. The response is misleading in that it:
To address the misleading error in ASP.NET Core 5.0, the ExceptionHandlerMiddleware throws the original exception if the exception handler can't be found. As a result, an HTTP 500 response is produced by the server. The response will be easier to examine in the server logs when debugging the error that occurred.
For discussion, see GitHub issue dotnet/aspnetcore#25288.
5.0 RC 1
The Exception Handler Middleware produces an HTTP 404 response if the configured exception handler can't be found.
The Exception Handler Middleware throws the original exception if the configured exception handler can't be found.
The HTTP 404 error doesn't make it obvious that an exception occurred on the server. This change produces an HTTP 500 error to make it obvious that:
There are no API changes. All existing apps will continue to compile and run. The exception thrown is handled by the server. For example, the exception is converted to an HTTP 500 error response by Kestrel or HTTP.sys.
None
<!-- ### Category ASP.NET Core ### Affected APIs Not detectable via API analysis -->