ASP.NET CORE Request Processing

In this tutorial will discuss and understand core request processing and middleware pipeline in core.

ASP.NET Core request processing is sequence of the events , stages and component that interact with each other to process HTTP request and generate response that goes back to the client.

Main Method In Program.cs:

When application starts it looks for this Main() method and this is where the execution starts.

This Main() method configures core and starts it and at that point it becomes an core web application.

If you take a look at the Main() method, it calls CreateHostBuilder() method passing it the command line arguments.

public class Program
        public static void Main(string[] args)

        public static IHostBuilder CreateHostBuilder(string[] args) =>
                .ConfigureWebHostDefaults(webBuilder =>
CreateDefaultBuilder() method creates a web host with pre-configured default settings.
As part of setting up a web host, Startup class is also configured using the UseStartup() extension method of IHostBuilder class.


By convention, the startup class in ASP.NET Core is named Startup. This class has 2 methods.

ConfigureServices() method configures services required by the application.

Configure() method sets up the application’s request processing pipeline. This request pipeline is configured with the help of different middle wares.


Middleware components is use to setup a request processing pipeline in ASP.NET Core. this pipeline that determines how a request is processed. The request pipeline is configured as part of the application startup by the Configure() method in Startup.cs file

MVC Route Handler 

MVC Route Handler begins the process of initializing and executing a controller.Whenever a request is received by MVC, it is the job of the routing engine to match the request URL with the registered routes. After finding the matched route, the route handler for the route is being called. Each route can have its own route handler. A route handler is a class that implements IRouteHandler interface.

Controller Factory

Controller Factory which is responsible for creating an instance of the controller class. Controller factories are an important extension point in the ASP.NET MVC Framework. They allow you to take on the responsibility of creating controllers, which enables you to apply logic for every single controller in your application. You can use controller factories to apply a custom IActionInvoker instance to all your controllers, or perhaps to add custom logging. The most common case of a controller is to enable support for dependency injection tools.

Controller Action Invoker

Controller Action Invoker is a component which find and selects an appropriate Action Method on that controller to process the request. Before the method is called Model Binding takes place, which maps additional data from our HTTP requests to parameters on our Action Methods.

Action Filter

MVC Action Filters are also called before and after the method generates an Action Result. Action filters are used to implement the logic that get executed before or after a controller action executes.

Action Result

After our Action Result has been generate and If the result is of type view , then View Engine will be called and is responsible for finding and rendering our view. If the result is not View , the Action Result will usually execute and generate its own response. This result Execution is what finally generates the response to the original HTTp request that goes back to the Client.

You can watch our video version of this tutorial with step by step explanation