Kestrel Web Server &Reverse Proxy in ASP.NET Core

Shivani Nalawade
4 min readMay 24, 2020

Before going through this huge knowledge ocean,I would like to clear what actually is this Web Server?

Web server is server software that accept HTTP Request send by a web clients and provide appropriate response.

Suppose, client sends request for a web page, the web server search for the requested page if requested page is found then it will send it to client with an HTTP response.

Kestrel Web Server :

  • Kestrel is an open source,cross platform and a default web server used for ASP.NET Core applications.
  • By itself as an edge server processing requests directly from a network, including the Internet.
  • It is native web server usually used for MVC Core applications or to process MVC Core request.
  • Asp.Net Core applications run Kestrel web server as in-process server to handle web request.
  • Kestrel web server supports SSL( Secure Sockets Layer) for security purpose.

As of now, we are using visual studio to run the ASP.NET Core application. By default, the visual studio uses IIS Express to host and run the ASP.NET Core application. So the process name is IIS Express

ASP.NET applications are tightly coupled to the Internet Information Services or(IIS). The IIS is a complete web server with all the features that you require out of a Web Server.

Executing the Asp.Net Core Application with Kestrel :

  • The older ASP.NET applications are tightly coupled to the Internet Information Services or IIS. The IIS is a complete web server with all the features that you require out of a Web Server.
  • In asp.net core application when we press F5 to run the applicaton & it uses “IISExpress” as web server
  • In asp.net core application when we press F5 to run the applicaton & it uses “IISExpress” as web server

Run using DotNet CLI :

  • You can also run the application using command prompt.
  • The following image shows how to use dotnet run cli command to start the kestrel web server. To run the project folder, following command

The kestrel starts and listens on port 5000.

Reverse Proxy :

Reverse proxy is used by the server such as a web server

  • A proxy server acts as an intermediary between a client and a server in order to perform processing like caching, traffic monitoring, resource access control, etc
  • A Reverse Proxy is a special type of proxy server that hides the target server to the client.
  • Reverse proxies are typically implemented to help increase security, performance, and reliability and also provides additional layer of configuration and defense.
  • The reverse proxy server takes requests from the Internet and forward these requests to one of the web servers.
  • A reverse proxy also provides the ability to direct requests based on a user device, location, network conditions, application health and even the time of day.
  • Only the reverse proxy server requires an SSL certificate, and the server can communicate with the application server on the internal network using normal HTTP.

When to use Kestrel and reverse proxy together :

  • Kestrel server doesn’t support sharing the same IP and port among multiple processes it always needs a reverse proxy server to share a IP address and ports among multiple processes.
  • A reverse proxy that can share ports has the ability to forward requests to Kestrel on a unique IP and port.

I hope this guide has been helpful for you.

--

--