Tutorials ASP.NET Core Web API Tutorial
ASP.NET Core Kestrel Web Server — Complete Guide
ASP.NET Core Kestrel Web Server — Complete Guide: free step-by-step lesson with examples, common mistakes, and interview tips — part of ASP.NET Core Web API Tutorial on Toolliyo Academy.
On this page
ASP.NET Core Web API Tutorial · Lesson 23 of 175
ASP.NET Core Kestrel Web Server
Beginner → Intermediate → Advanced → Professional
Beginner · 1 — Setup & foundations · ~6 min · Module 2: Web API Basics
What is this?
Kestrel is the built-in cross-platform web server in ASP.NET Core. It listens on ports (e.g. 5001 HTTPS) and forwards requests into middleware and controllers.
Why should you care?
Interviewers ask Kestrel vs IIS. Answer: Kestrel handles HTTP; IIS or Nginx can reverse-proxy in production.
See it live — copy this example
Create a Web API (dotnet new webapi), paste the example, run dotnet run, test in Swagger.
// launchSettings.json — applicationUrl
"https://localhost:7001;http://localhost:5001"
// Program.cs
app.Run(); // Kestrel starts listening
Run Example »
This lesson uses terminal or setup steps. Run commands on your computer — the live editor appears on coding lessons.
What happened?
- In development Kestrel alone is enough.
- In production, IIS or Nginx terminates TLS and proxies to Kestrel (out-of-process) or hosts in-process.
Try it yourself
- Run dotnet run and note URLs in console.
- Change applicationUrl in launchSettings.json.
- Hit /swagger and confirm Kestrel responds.
- Change a route URL or DTO property and save — test again in Swagger or curl.
- Return the wrong status code on purpose (404 instead of 200) and see what the client shows.