Advertisement
Intermediate ASP.NET Core, Hosting Models: Kestrel, IIS & Reverse Proxies

How does hosting an ASP.NET Core application in a Docker container change considerations around Kestrel configuration and reverse proxying compared to traditional VM or bare-metal hosting?

Short answer

In a containerized deployment, Kestrel typically runs as the sole process inside each container listening on a fixed internal port, with the actual reverse proxying, load balancing, and TLS termination handled by external infrastructure (a Kubernetes Ingress controller, a cloud…

Save ASP.NET Core mock interview
Advertisement
AModel answer
In a containerized deployment, Kestrel typically runs as the sole process inside each container listening on a fixed internal port, with the actual reverse proxying, load balancing, and TLS termination handled by external infrastructure (a Kubernetes Ingress controller, a cloud load balancer, or a service mesh sidecar like Envoy) rather than IIS or an in-container reverse proxy -- this shifts responsibility for concerns like connection limits and TLS to the surrounding orchestration layer, while the container itself usually just needs Kestrel configured for plain HTTP on a known internal port.
# Dockerfile
FROM mcr.microsoft.com/dotnet/aspnet:8.0
ENV ASPNETCORE_URLS=http://+:8080
COPY . /app
WORKDIR /app
ENTRYPOINT ["dotnet", "MyApp.dll"]

# Kubernetes Service/Ingress handles TLS termination and load balancing externally,
# container itself just exposes plain HTTP on 8080 internally
Real-world example
A microservice deployed to Kubernetes runs Kestrel listening on plain HTTP internally, relying entirely on the cluster's Ingress controller for TLS termination and external routing, simplifying the container's own configuration compared to a traditional VM deployment that would need Kestrel or IIS to handle HTTPS directly.
Likely follow-ups
  • What are the security implications of running plain HTTP inside the cluster network versus end-to-end encryption?
  • How does a service mesh sidecar proxy change this picture further?
Related topics