In conclusion, the middleware pipeline is a system designed to handle each HTTP request, route it to the appropriate destination, and return the correct response. Understanding the functionality of each component is vital to creating a customized pipeline which accurately reflects our desired processing chain. Here are the components we covered in this lesson:
UseDeveloperExceptionPage()provides an exception page specifically designed for developers
UseExceptionHandler()logs and catches errors and routes users to a general error page
UseHttpsRedirection()redirects HTTP requests to the more secure HTTPS protocol
UseStaticFiles()allows static files, like CSS and images, to be served
UseRouting()allows route matching
UseAuthorization()ensures requests are authorized.
UseEndpoints()adds endpoint execution to the middleware pipeline. It runs the code associated with the selected endpoint.
Hopefully, this lesson has provided you with enough information to be able to customize and configure your own middleware pipeline. Happy configuring!
View ASP.NET middleware documentation to see examples and a full-list of available built-in middleware components.