Since .NET Core cross-platform, ASP.NET Core projects can run on both Windows and Linux, and if deployed on Windows, they can be deployed on IIS or run directly through the command line, independent of IIS services, due to the inclusion of Kestrel containers in ASP.NET Core.
For more information on how to deploy ASP.NET Core applications to IIS services, you can refer to the following:
ASP.NET Core is deployed in IISIn-ProcessandOut-Of-ProcessTwo hosting models
Resources:
The hyperlink login is visible.
The hyperlink login is visible.
In-Process model
Since ASP.NET Core 3.0,In-Process hosting is enabled by default for all applications deployed to IIS, the web.config file looks like this:
can be seenhostingModel="inprocess", an in-process modelKestrel is not used, but instead uses IISHttpServer() to implement a new web server hosted directly inside the IIS application pool, which is somewhat similar to how traditional ASP.NET was introduced into IIS.
The following diagram illustrates the relationship between IIS, ASP.NET Core modules, and in-process hosted applications:
Trying to access the website, you can see the server through the response header, as shown in the image below:
Looking at the processes through the task manager, there are only 2 processes, as shown in the figure below:
Out-of-Process model
This model IIS acts as a reverse proxy, and when it receives a request, it needs to forward it to the Kestrel service, which is a cross-platform web server embedded in ASP.NET Core applications.
The following diagram illustrates the relationship between IIS, ASP.NET Core modules, and out-of-process hosted applications:
We modify the web.config file as follows:
When we access the website through a browser, we can see that the server value of the response header has become Kestrel, as shown in the figure below:
Looking at the task manager at the same time, I found that there are 3 processes, as shown in the figure below:
summary
In the InProcess managed model, requests and responses are provided through w3wp.exe or IISExpress, whereas in the OutOfProcess worker process involved, it is dotnet.exe In the InProcess managed model, a single web server is used, while in the OutOfProcess managed model, two web servers can be used.
The obvious reason for using the new In-Process model is that it's faster and uses fewer resources,The InProcess managed model provides better performanceBecause it runs directly in the process of the IIS application pool. There is no internal HTTP traffic and overhead, and requests are processed immediately.
|