Introducing middleware
The majority of you 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 about middleware instances in detail, as 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 – or maybe more – middleware components.
A middleware component is a piece of code that handles the request pipeline. Imagine the request pipeline as a huge tube where you can call something and then an echo comes back. The middleware is responsible for the creation of this echo – it manipulates the sound to enrich the information, handling the source sound, or handling the echo.
Middleware components are executed in the order in which they are configured...