简体   繁体   中英

When hosting .NET core web app in IIS, what are the pros and cons between "In process" and "out of process" hosting model

When hosting a .NET core web application in IIS, you can choose between in process and out of process hosting model.

Except for better performance by using in process, what are some pros and cons between "In process" and "out of process" hosting model?

And is one better than the other for test/dev vs production?

I would imagine that a "out of process" hosting model is easier to attach a debugger to.

Since ASP.NET Core 3.0, "in process" is the default, see this Microsoft page . When hosting the web application on IIS.ASP.NET Core Module forwards the requests to IIS HTTP Server (IISHttpServer). The IIS HTTP Server is a server that runs in-process with IIS.

If you used Out-Of-Process hosting model, IIS HTTP Server won't be used. Instead Kestrel web server is used to process your requests.

From Rick's blog :

"In process" provides better performance and is generally less resource intensive as it avoids the extra network hop between IIS and Kestrel and maintaining an additional process on the machine that needs to be monitored.

There are a few cases when OutOfProcess hosting might be desirable, such as for trouble shooting and debugging a failing server (you can run with console logging enabled for example) or if you want to be 100% compatible between different deployments of the same application, whether it's on Windows or Linux, since Kestrel is the primary mechanism used to handle HTTP requests on all platforms.

With the InProcess model you're not using Kestrel, but rather a custom IISHttpServer implementation that directly interfaces with IIS's request pipeline.

But for most intents and purposes I think running InProcess on IIS is the way to go, unless you have a very specific need to require Kestrel and OutOfProcess hosting.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM