Asp.Net Core Process Hosting Types

.Net Core Process Hosting Explain By Sagar Jaybhay

Two types of Process Hosting in Asp.Net Core

  1. InProcess Hosting
  2. OutOfProcess Hosting

In-process Hosting

To configure In-process hosting in the project you need to include this line which is below.


Also, there is another way to set the hosting by going into project properties -> build -> web-server -> setting in the middle pane and select the hosting model.

In-Process Hosting

In this CreateWebHostBuilder will call UseIIS() method and it will host the app inside the worker process(w3wp.exe) or IIS(iisexpress).

Performance point of view In-process is good than OutOfProcess hosting on the basis of higher throughput of request.

To check which hosting type you use below code.

public class Startup
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit
        public void ConfigureServices(IServiceCollection services)

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
            if (env.IsDevelopment())

            app.Run(async (context) =>
                await context.Response.WriteAsync(System.Diagnostics.Process.GetCurrentProcess().ProcessName);
In-Process Hosting-1

By default, visual studio will get express as hosting but if you host site under iis then it will give process name w3wp.exe


In out of process hosting there are 2 web servers are involved which is internal and external.

  1. Kestrel: It is an internal web-server
  2. External web servers: IIS, Nginx or Apache or Tomcat

In this Outofprocess hosting, we have performance penalty for proxying request in internal and external Webhosting.

If you remove the AspNetCoreHostingModel from .csproj file then it will take default outofprocess hosting.

Difference between In-process and OutOfProcess hosting

In Process Out Of Process
Process name w3wp.exe Process name dotnet.exe
Only one webserver 2 webserver present
Higher performance Lower performance


It is a cross-platform web server for core. It is added by default as an internal web server in asp .net core. The process which is used to host and run our application is dotnet.exe

It is actually internet-facing web-server which can take all incoming request from the internet and pass to the external web server.

For this, you need to go on a developer command prompt and then go to the project folder and type the command

Point to remember when .net core application run from CLI it uses as Kestrel server.

dotnet run
Kestrel Server

Kestrel can be used as a Reverse proxy server, which means the internet-facing servers are IIS, Nginx or Apache and Kestrel is working as background.

When we run our application using .net core CLI then hosting settings are ignored. This also not consider whatever you mentioned in csproj files.

Sagar Jaybhay, from Maharashtra, India, is currently a Senior Software Developer. He has continuously grown in the roles that he has held in the more than seven years he has been with this company. Sagar Jaybhay is an excellent team member and prides himself on his work contributions to his team and company as a whole.

Related posts