In this article, we will learn about In-Process and Out-Of-Process hosting models in ASP.NET Core.
At the point when you push your web application to IIS, different solicitations to the application are taken care of by what is known as ASP.NET Core Module.
In-Process and Out-Of-Process Hosting Model
Under default settings, the hosting model for your application is in process. This implies ASP.NET Core Module sends the requests to IIS HTTP Server.
This outcome is incredible execution when contrasted with the Out Of Process model.
In-Process models pass the default Kestrel web server of ASP.NET Core.
If you have any desire to use the Out-Of-Process hosting model in your ASP.NET Core Application then IIS HTTP Server will not be utilized.
In the Out-Of-Process Hosting, the Kestrel web server is utilized to handle your requests. The out-of-process model can be used with .Net Core V2.2 and earlier. The out-of-process model uses IIS as a proxy to forward the incoming requests to dotnet.exe.
How to change from Out-Of-Process to In-Process?
If you host a large and complex ASP.NET Core application and you are concerned about the performance of the application then you should switch to the In-Process hosting model in case you are using the Out-Of-Process hosting model. We can switch from the Out-of-process hosting model to the In-process hosting model easily. Open .csproj file or right-click on the project file and select Edit Project.
Change this line ->
To below line –
What is Kestrel?
The Kestrel is an open-source and cross-platform web server for the ASP.NET Core application. That implies this server supports Windows, Linux, and macOS.
ASP.NET Core Module sends the requests to Kestrel webserver contrast with In Process hosting model and Out-Of-Process model in more slow execution.
ASP.NET Core applications run without kestrel web severer too. Naturally, the In-Process facilitating model will work out of the kestrel web server and it will utilize an IIS web server like w3wp.exe or iisexpress.exe
The in-process hosting model is better than the Out-of-process hosting model. The in-process hosting model is available for .Net core V2.2 and later. A newer version of the ASP.Net Core application automatically configures InProcess hosting, in case you are migrating from an older version of the ASP.NET Core application then you have to do a project-level configuration.