Join Jeff Fritz for an in-depth discussion in this video Pipeline definition and terminology, part of ASP.NET Core: Middleware.
- [Instructor] How does this pipeline work? Well, ASP.NET Core Middleware is designed to allow the pipeline management through simple class definitions and simple function definitions. This is a new version of the HTTP module that you may have seen in previous versions of ASP.NET. We're going to be inserting pieces in here that control each request and delegate and return various functions and capabilities based on how we have our pipeline configured.
You can see from the diagram on the right that requests are processed from top to bottom, from outside to inside, and back again. So, a request will come in, go through the first layer of Middleware and, if there is a next call, it'll proceed to the next, and then the next. If there is not a next call on that final piece of Middleware, it will return in any other logic that has been delegated after the next calls in Middleware Two or One will be executed before a response is sent back to the browser.
Middleware classes, as we define them, are created once at application startup and then their contents are executed every time a request comes in.