.NET › Global Exception Handling & Middleware

What happens by default in ASP.NET Core if you don't configure any global exception handling middleware at all?

Beginner

Answer

Without any exception handling middleware configured, an unhandled exception propagates all the way up through Kestrel, resulting in either a bare 500 Internal Server Error with no body (in Production) or, if UseDeveloperExceptionPage is active, a detailed HTML error page showing the full stack trace -- neither is appropriate for a real production API, which is why configuring at least a basic UseExceptionHandler is considered essential baseline setup for any API expected to run in production.
// With NO exception handling middleware configured:
// An unhandled exception results in a generic 500 with an empty or minimal body
// -- no consistent JSON error format, no logging guarantee, no safe error message
Real-world example A newly bootstrapped API prototype that skipped configuring UseExceptionHandler entirely is caught in code review before its first production deployment, since every unhandled exception would otherwise return an unhelpful bare 500 response to API consumers.

Common follow-ups: What's the minimum viable exception handling setup for a new ASP.NET Core API?;Why does Kestrel itself not provide a default JSON error format?