What is Kestrel?
BeginnerConcept.NET builds (dotnet CLI)
Answer
Short answer
Kestrel is the fast, cross-platform web server built into ASP.NET Core. When you run dotnet Shop.Api.dll, Kestrel starts inside the app and listens for HTTP requests — no IIS or Apache needed. In production it usually sits behind a reverse proxy or load balancer (Nginx, Ingress, Azure App Gateway).
Example
ASPNETCORE_URLS="http://0.0.0.0:8080" dotnet Shop.Api.dll
# info: Now listening on: http://0.0.0.0:8080
Behind a proxy
When TLS ends at the load balancer, the app must trust forwarded headers so it knows the original scheme and client IP:
app.UseForwardedHeaders(new ForwardedHeadersOptions {
ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
});
Defaults to know
- .NET 8+ container images listen on 8080 (
ASPNETCORE_HTTP_PORTS=8080); older ones used 80. - On Windows, apps can still be hosted in IIS using the ASP.NET Core Module, which forwards to Kestrel or runs in-process.
What to say in the interview
"Kestrel is ASP.NET Core's built-in web server. In containers it listens on 8080 by default; we put it behind an Ingress or load balancer and configure forwarded headers so the app sees the real scheme and client IP."
More on .NET builds (dotnet CLI)
How do you build and run a .NET application?BeginnerWhat is the difference between .NET Framework and modern .NET?BeginnerWhat are .csproj and .sln files?BeginnerWhat is NuGet?BeginnerExplain dotnet restore, build, test and publish.BeginnerHow does configuration work in ASP.NET Core (appsettings.json and environment variables)?Intermediate