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.
With ASP.NET Core 2.2 there's now an In Process hosting model on IIS which hosts ASP.NET Core directly inside of an IIS Application pool without proxying to an external dotnet.exe instance running the . NET Core native Kestrel Web Server.
The module allows ASP.NET Core apps to run behind IIS. If the Hosting Bundle is installed before IIS, the bundle installation must be repaired. Run the Hosting Bundle installer again after installing IIS. If the Hosting Bundle is installed after installing the 64-bit (x64) version of .
In-process hosting runs an ASP.NET Core app in the same process as its IIS worker process. In-process hosting provides improved performance over out-of-process hosting because requests aren't proxied over the loopback adapter, a network interface that returns outgoing network traffic back to the same machine.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With