Home About Lessons Blog On The Mic Contact Projects
Lessons DEPLOY · C#

IIS Hosting Model — inprocess vs outofprocess

8 min read · Emre Ulutabak
1
IIS and ASP.NET Core

IIS (Internet Information Services) is the web server on Windows that handles incoming HTTP requests. ASP.NET Core applications do not run directly inside IIS — they run on their own server called Kestrel.

The bridge between IIS and ASP.NET Core is built by the ASP.NET Core Module (ANCM). This module receives incoming requests and forwards them to the application. But exactly how it forwards them depends on the hosting model.

2
What is inprocess?

Think of a factory. The manager works directly on the production line — same space, same team. Fast communication, minimal delay.

In inprocess mode, the ASP.NET Core application runs inside IIS's worker process, w3wp.exe. There is no extra communication layer in between. That is why it is faster.

But there is a risk: if w3wp.exe crashes, all applications running inside that same process crash together.

💡
inprocess: faster, but applications in the same process affect each other.
3
What is outofprocess?

In the same factory, the manager now works in a separate room. Messages come from the production line, the manager processes them in their own room, and sends back the response.

In outofprocess mode, the ASP.NET Core application runs in its own dotnet.exe process, independent from IIS. IIS only acts as a middleman — it receives the request, forwards it to Kestrel, and sends back the response.

The advantage: if one application crashes, the others are not affected. Each application lives in its own isolated process.

💡
outofprocess: slightly slower, but provides crash isolation. Essential on shared hosting.
4
Which one and when?

Both have their use cases. Instead of blindly picking one, the decision should be based on context.

  • Shared hosting, multiple sites sharing the same app pool: outofprocess — required for crash isolation.
  • Dedicated server, single application: inprocess — maximum performance, no isolation concern.
  • Azure App Service: inprocess — Microsoft's recommended mode.
  • Docker / container: No IIS, Kestrel runs directly — hosting model is irrelevant.
💡
`dotnet publish` generates `inprocess` by default. Don't forget to change this on shared hosting.
5
web.config setting

The hosting model is determined by the hostingModel attribute in the web.config file. Checking this value after publishing is a good habit.

xml
<!-- inprocess: uygulama IIS worker process (w3wp.exe) içinde çalışır -->
<aspNetCore processPath="dotnet"
            arguments=".\MyApp.dll"
            stdoutLogEnabled="false"
            stdoutLogFile=".\logs\stdout"
            hostingModel="inprocess" />

<!-- outofprocess: uygulama kendi dotnet.exe process'inde çalışır -->
<aspNetCore processPath="dotnet"
            arguments=".\MyApp.dll"
            stdoutLogEnabled="false"
            stdoutLogFile=".\logs\stdout"
            hostingModel="outofprocess" />
💡
If 5 sites on shared hosting share the same app pool, all must be outofprocess — if one stays inprocess, it affects the pool.
6
Mini quiz
MINI QUIZ
If multiple sites on shared hosting share the same app pool, which hosting model should be chosen?
inprocess — because it is faster
outofprocess — for crash isolation
Either can be used, it doesn't matter
Hosting model cannot be chosen on shared hosting