ASP.NET - Kestrel vs IIS vs Nginx Hosting

These three components are common ways to host ASP.NET Core apps. Kestrel is the built-in server, IIS is a Windows web server, and Nginx is a popular Linux web server. Each one plays a different role and can be used alone or together.


Kestrel
Kestrel is the default web server included with ASP.NET Core. It runs cross-platform and handles HTTP requests directly. It is lightweight and fast but does not include extras like security filtering, caching or request limiting. For production, it is often paired with a reverse proxy because proxies add features Kestrel does not provide.


IIS
IIS is a Windows web server that can host ASP.NET Core using two modes. In in-process mode, the app runs inside IIS for the highest speed. In out-of-process mode, IIS forwards requests to Kestrel. IIS provides SSL, logging, load limits and configuration tools, making it suitable for enterprise Windows environments.


Nginx
Nginx is a high-performance web server often used on Linux. It forwards requests to Kestrel and handles incoming connections, caching, compression and static content more efficiently. Nginx fits cloud and container deployments and works well when scaling across multiple servers.


When to Use Each
Use Kestrel alone for development or simple setups. Choose IIS on Windows servers where management and built-in features matter. Use Nginx on Linux servers or in cloud platforms where reverse proxy capability is needed. The decision usually depends on operating system and required features.


Example (Typical Linux Setup)

# Nginx listens on port 80
# Kestrel listens on port 5000
server {
    listen 80;
    location / {
        proxy_pass http://localhost:5000;
    }
}

Flow
Browser → Nginx (filter, SSL, static files) → Kestrel (app logic)