Terminal middleware
Terminal middleware is a request-pipeline component that handles a request and returns a response without invoking subsequent components.
ASP.NET Core in Action, 3e
Terminal middleware is a middleware component that stops further pipeline processing by generating and returning a response.
- How it is used
- Uses terminal middleware to generate specialized responses before endpoint routing handles the request.
- How deep it goes
- Explains short-circuiting, reverse response flow, and practical use cases, but stops short of implementing the three custom middleware approaches.
- Examples
- Uses authorization denial, Swagger, a welcome page, and a current-time plain-text response as concrete terminal responses.
- What you can do after
- Apply it via ASP.NET Core middleware to stop request processing and return a specialized response.
Read how ASP.NET Core in Action, 3e explains terminal middleware →
Building Web APIs with ASP.NET Core
Terminal middleware is middleware that can end HTTP request processing by returning a response without invoking later pipeline components.
- How it is used
- Explains how ASP.NET Core components end HTTP requests or forward them through the request pipeline.
- How deep it goes
- Defines conditional and unconditional termination, registration order, and the Run convention without implementing custom middleware.
- Examples
- Uses static-file responses, HTTPS redirects, and a Program.cs pipeline ending with app.Run.
- What you can do after
- Configure middleware order and recognize when a component terminates or forwards an HTTP request.
Read how Building Web APIs with ASP.NET Core explains terminal middleware →
Related concepts
- middlewarekind of · Middleware is an intermediate software component or layer that processes or mediates requests, messages, or operations between other components, often adding behavior or controlling their flow.
- Runproduced by · Run is an ASP.NET Core API operation that either terminates a request pipeline with middleware or starts the application host to process requests.
- endpoint routingcontrasts with · Endpoint routing is an ASP.NET Core mechanism that matches incoming HTTP requests to endpoints and separates endpoint selection from endpoint execution.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

