As you can see in the above image, A request came from the user to IIS through the internet over HTTP or HTTPS protocol. ASP.NET Core Module receives the request which is passed to IIS HTTP Server. After IIS HTTP Server, the request is sent to the ASP.NET Core application’s middleware pipeline. Middleware handles the request and passes it to the HttpContext instance to the application’s logic. Then application response is passed to IIS through the IIS HTTP Server. Further, IIS sends the response back to the user who initiated the request.
Change the code in Configure method as highlighted in the below image which is for finding the ProcessName on which application is running.
Now right click on the project in order to view the properties.
Click on Debug tab in order to see the Hosting Model for the selected launch profile. We can change the hosting model from here (Dropdown contains three values that are Default (InProcess), InProcess, OutOfProcess) as well as by editing the .csproj file.
Right-click on the project in order to edit the .csproj file.
![InProcess Hosting Model In ASP.NET Core]()
In order to configure the application for InProcess hosting, set the value of AspNetCoreHostingModel property to InProcess as shown below.
Now run the application on the IIS Express profile, application is run on the iisexpress worker process. As we are using InProcess hosting model for the application and in InProcess hosting model, the ASP.NET Core application is hosted inside of the IIS Worker Process i.e. w3wp.exe in case the application is hosted on IIS or IISExpress (if the application is launched through the IIS Express).
Go to Developer tools by clicking on Inspect element, then click on the Network tab in order to see the request and response header details. In the response header, it's clearly visible that the server which is sending the response is Microsoft-IIS.
Now let’s run the application through the Profile i.e. FirstCoreApplication (this can be as per your project) which will host the application on the Kestrel server.
Go to Developer tools by clicking on Inspect element, click on the Network tab in order to see the request and response header details. In the response header, it's clearly visible that the server is Kestrel. On running the application through the DotNet CLI, the application does not follow the InProcess hosting model, as Worker Process is dotnet.exe. dotnet.exe is the process which runs and host application with the kestrel server.
I hope this article will help you in understanding InProcess hosting model. In the next article, we will understand the OutOfProcess hosting model.
Thanks.