Introducing middleware
The majority of readers probably already know what middleware is, but some of you might not. Even if you have already been using ASP.NET Core for a while, you don't really need to know details about middleware, because they are mostly hidden behind nicely named extension methods such as UseMvc()
, UseAuthentication()
, UseDeveloperExceptionPage()
, and so on. Every time you call a Use
method in the Startup.cs
file, in the Configure
method, you'll implicitly use at least one, maybe more, middleware.
A middleware is a piece of code that handles the request pipeline. Imagine the request pipeline as a huge tube you can call something in to and an echo comes back. The middleware is responsible for the creation of this echo, manipulating the sound to enrich the information, handling the source sound, or handling the echo.
Middleware is executed in the order in which it is configured. The first middleware configured is the first that gets executed.
In...