Posts

Showing posts with the label ASP.NET Core | Request pipeline or middleware pipeline

ASP.NET Core | Request pipeline or middleware pipeline

Image
A request pipeline or middleware pipeline consists of a sequence of request delegates which are called one after another to perform operations before and after the next delegate. For more about request processing pipeline for ASP.NET MVC visit  Request Processing Pipeline . The ASP.NET Core request pipeline consists of a sequence of request delegates, called one after the other. The following diagram demonstrates the concept. The thread of execution follows the black arrows. Each delegate can perform operations before and after the next delegate. Exception-handling delegates should be called early in the pipeline, so they can catch exceptions that occur in later stages of the pipeline. The simplest possible ASP.NET Core app sets up a single request delegate that handles all requests. This case doesn't include an actual request pipeline. Instead, a single anonymous function is called in response to every HTTP request. C# Copy var builder = WebApplication.CreateBuilder(args); var a...