Retrace will reach End of Life on March 31, 2027. Click here to learn more.

What is Kestrel Web Server? How It Works, Benefits, and More

By: Alexandra
  |  July 24, 2017
What is Kestrel Web Server? How It Works, Benefits, and More

Kestrel is open-source (source code available on GitHub), event-driven, asynchronous I/O based server used to host ASP.NET applications on any platform. It’s a listening server and a command-line interface. You install the listening server on a Windows or Linux server and the command-line interface on your computer.

It was launched by Microsoft along with ASP.NET Core. All ASP.NET Core apps utilize a new MVC framework and the Kestrel web server. These new apps can run on full .NET Framework or .NET Core. ASP.NET is used on 15% of all websites for which server-side programming languages are known, and as such, it’s important to understand how Kestrel works and the benefits it offers, so that’s why we’ve decided to take a closer look at this web server in today’s post.

A Definition of the Kestrel Web Server

Kestrel is considered a preferred web server for newer ASP.NET applications (see this post for a comparison to IIS and why you need both). It is based on the libuv library, the same one used by node.js. Libuv supports an event-driven style of programming. Some of its core utilities include:

  • Non-blocking network support
  • Asynchronous file system access
  • Timers
  • Child processes

It allows ASP.NET Core applications to be run easily on other cross-platform webservers such as Nginx and Apache, without the need to address varying startup configurations. By using Kestrel as an in-process server, applications will have a consistent process (Startup (Main()Startup.ConfigireServices()Startup.Configure()) ) even with cross-platform support.

How Kestrel Web Server Works

Applications are often written to respond to human actions. With event-driven programming, there is a loop that listens for events. It then triggers a callback function. To reduce the number of SYS calls, all other work is executed in managed code on standard .NET worker threads.

Kestrel provides an event loop and callback-based notifications of I/O. Libuv manages the gathering and monitoring of events from the OS. Moreover, the user can register callbacks as an event occurs. So, Kestrel uses libuv for I/O work and supports running multiple event loops.

Because it is so lightweight, Kestrel does not allow you to do SSL termination, URL rewrites, or GZip compression, but that same lightweight design can make other web servers look slow by comparison. It was built to be fast; in fact, it’s six times faster than node.js for static and plain text operations.

Benefits of Kestrel

Kestrel has support on all platforms and versions supported by .NET Core. Furthermore, it is included by default in ASP.NET Core new project templates and can provide better request processing performance. When you create a new project in Visual Studio, your project is automatically configured to run in Kestrel.

As stated earlier, it’s not a fully-featured web server, but that’s precisely why it’s fast. If you feel the need for speed, Kestrel is the answer–especially since it is designed to be used in production for ASP.NET.

What you can do is run it behind a more fully-featured webserver such as IIS or NGINX. You can run it behind IIS using the HttpPlatformHandler or behind IIS Express using HttpPlatformHandler by Visual Studio. Moreover, you’ll want to support it in your ASP.NET Core projects so that they can be conveniently run by developers on any of the supported platforms.

Now, even if you are not working cross-platform, you can run ASP.NET on a web server straight from the command line.

Since Kestrel is not a fully-featured web server, you should run it behind IIS or NGINX. It was designed to make ASP.NET as fast as possible but is limited in its ability to manage security and serve static files. If you’re using ASP.NET Core with Kestrel, you can take advantage of Prefix for powerful code profiling.

Additional Resources and Tutorials

For more information, including some helpful tutorials, visit the following resources:

Improve Your Code with Retrace APM

Stackify's APM tools are used by thousands of .NET, Java, PHP, Node.js, Python, & Ruby developers all over the world.
Explore Retrace's product features to learn more.

Learn More
togel slot situs toto pucuk4d agb99 togel toto slot toto togel toto slot indobet situs toto toto slot toto slot toto slot toto toto situs toto toto slot slot depo 10k toto togel 8kuda4d toto judi bola kenangan4d toto situs toto toto toto toto situs toto toto toto slot bobatoto daftar situs toto logototo situs toto situs toto toto bydplay patentoto situs toto slot 4D situs toto leon188 situs toto slot gacor terbaru toto toto slot toto situs toto situs toto MORFINTOTO ilmutoto toto mix parlay bayitoto toto toto toto toto ilmutoto toto toto mawar800 login popotogel prize hongkong malam ini toto slot gacor joker11 toto slot pucuk4d lingkartoto lingkartoto Pucuk4D Login PREMANTOTO UGSLOT slot gacor slot gacor slot gacor AMANAHTOTO toto ilmutoto ILMUTOTO 8kuda4d titi4d lingkartoto lingkartoto toto situs toto ilmutoto toto slot gacor rp888 https://foundvinylrecords.com/ depo 5k slot gacor toto slot gacor toto mataramtoto toto panen100 semibola slot gacor Pakde4D situs gacor MySlot188 SlotPoker188 toto togel 77ag monk4d popo togel tikus4d https://asupantoto.co/ Login Batak5D pompa4d