Kestrel vs IIS Web Servers
You will find a lot of web-based applications being developed for a wide variety of purposes. It’s also not uncommon to see that most of these applications are written in a different programming language. Development of them can be carried out in a local IDE, which is also used for developer-level testing and validation.
However, if an application has to be accessed by multiple people without any dependency on any users, then the same application has to be put in a common powerful machine. This common powerful machine is nothing but your servers.
Now the million-dollar question is - just by putting the files of the application inside a server, will we be able to achieve our goal? Absolutely not. They need to be hosted in a web server platform to make it accessible for multiple people through the internet/intranet.
Now, when you look at your choices for servers, you have predominantly Windows and Linux. Also, the webserver software differs for different types of servers.
All these days, until the invention of .Net Core, .Net-based applications could be hosted only in IIS-based web servers. And IIS was primarily designed to work with the Windows platform. In other words, they can be hosted and run only from Windows-based servers. This was a major negative.
Luckily, the .Net Core platform started offering the ability to run the application across multiple platforms through Kestrel.
In this post, we will understand the key differences between Kestrel and IIS Web Servers.
Tables of Contents
- What is a web server?
- What is IIS?
- What is Kestrel?
- Kestrel vs IIS Server
What is a web server?
As mentioned earlier, web servers are used for hosting web applications. A web server is responsible for processing input and output messages. It allows the apps to process messages that come through a specific TCP port. For example, HTTP requests usually come through port 80 while HTTPS requests come through 443.
Let’s consider a scenario - when a user requests a page by specifying a URL (https://www.partech.nl), a series of steps is followed to load the application. Here are they -
- Through DNS (Domain Name System), the browser will obtain the IP address of the domain of the website.
- The IP address will take the browser to the webserver at which the site is hosted.
- The browser requests for a file from the webserver through the request.
- The web server returns the requested page.
- In case something goes wrong while looking for the file, the webserver will return the response with an error message.
With this basic understanding of web servers, let’s understand IIS and Kestrel.
What is IIS?
IIS stands for Internet Information Services. It is a powerful, flexible, and general-purpose webserver from Microsoft which runs on the Windows platform. It is bundled with Windows as a feature and can be turned on or off based on the need. Though IIS has been around for two decades, it still provides support to run applications that were developed 20 years ago and as well as the applications that were written just last year using the latest .Net technologies.
What is Kestrel?
Kestrel is a cross-platform, lightweight, and open-source web server used along with .Net Core applications. All .Net Core applications make use of Kestrel for hosting. It is based on Libuv (asynchronous Input/Output Library) developed for Node.js. It provides compatibility for .Net-based applications to run on Windows, Linux, and Mac machines.
As it is lightweight, it is not as powerful as IIS. But they can process the requests pretty quickly. Key features of Kestrel are Non-blocking network support, Child processes, Async IO operations, and Timers.
Let's now dive deep and understand the key differences between Kestrel and IIS.
Kestrel vs IIS Servers
Kestrel supports cross-platform, which is nothing but the ability to run on multiple platforms (Windows/Linux\Mac servers). Also, it can be run on multiple servers such as Nginx and Apache. When Kestrel is not being used, then for each server, the startup file of the code has to be modified as per the server's needs.
With its lightweight component, Kestrel has better single and concurrent request processing ability over the IIS server.
Managing IIS-based servers is quite easy and sophisticated. Kestrel applications have to be set up as Windows services and have to be accessed through the command line. So, configuring Kestrel through CLI after every restart is a tedious process.
Microsoft recommends using IIS, Nginx, or Apache as a front-facer for Kestrel, as Kestrel lacks the security of IIS
IIS allows HTTP applications to be present in the same physical machine in separate and isolated processes which share the network infrastructure to send and receive over the same port. This feature is not available in Kestrel.
The reverse proxy feature help in achieving load balancing, web acceleration, caching, security and anonymity. IIS server is a reverse proxy server and Kestrel is an application server. The difference is, in an application server, the request from the browser directly hits the hosted application and the code gets executed. A reverse proxy server provides an additional level of abstraction and control over the network traffic.
Some of the common features between IIS and Kestrel include static files, compression, WebSocket protocol. However, more complex features like Windows authentication, Management console, request filtering, and limits, IP and Domain restrictions, FTP server, Response output caching, WebSocket protocol, HTTP redirect rules, Port Sharing, Application Initialization are not available in Kestrel.
Kestrel is not a full-fledged web server, but it provides fast execution of requests. IIS is a powerful competitor. Based on your needs, you can choose the server that you need for deploying the applications.