This article is a mirror article of machine translation, please click here to jump to the original article.

View: 7562|Reply: 2

[.NET Core] ASP.NET Core hosts the In-Process and Out-Of-Process models in IIS

[Copy link]
Posted on 2022-5-14 13:18:08 | | | |
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:

Deploy ASP.NET Core to IIS server
https://www.itsvse.com/thread-7838-1-1.html
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.





Previous:Nginx adds HTTP/2 protocol enabled
Next:Using HttpClient incorrectly can break your software
 Landlord| Posted on 2022-5-14 13:20:23 |
ASP.NET Performance in and out of the Core process:http://blog.iis7.com/article/5958.html
ASP.NET Core 5 performance test under IIS, Nginx, Caddy:https://cloud.tencent.com/developer/article/1788073
Posted on 2022-5-14 15:07:14 |
Learn to learn
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com