Kestrel - the new web server for ASP.NET 5

by DotNetNerd 8. November 2015 14:12

With ASP.NET 5 which is currently in Beta 8, Microsoft has launched a new web server named Kestrel, which is of course Open Source. There are a number of reasons they are building Kestrel, but most importantly to provide a cross-platform web server which does not rely on System.Web and a full version of the CLR in order to bootstrap the new execution environment (DNX) and CoreCLR - which was not possible with Helios.

Kestrel is based on libuv, which you might know if you have spent some time with NodeJS. Shortly put libuv is an asynchronous I/O library, which used a single threaded event loop model and has effecient async sockets support on Windows, OSX and Linux. Kestrel only uses libuv for I/O work and supports running multiple event loops, so all other work is done in managed code on standard .NET worker threads and optimized to reduce the number of SYS calls to a minimum.

Some of the most important things to know about Kestrel as a developer is that:

  • It is fast.
  • It is intended to be used in production for ASP.NET 5.
  • It is not a fully featured web server.
  • It is recommended that you run it behind a more fully featured webserver like IIS on Windows or NGNIX on Linux.
  • It is run behind IIS using the HttpPlatformHandler.
  • It is run behind IISExpress using HttpPlatformHandler by Visual Studio.
  • It is not supposed to be a generic libuv .NET server or wrapper.
  • It is a great option to at least include support for in your ASP.NET 5 projects so that your project can be easily run by developers on any of the supported platforms.
  • It supports https on the full .NET framework, and it is comming for .NET Core.
  • It is not planned to have http/2 support v1 but will come later.

You add support for Kestrel by including "Microsoft.AspNet.Server.Kestrel" in your project’s dependencies listed in project.json like this.

  "dependencies": {
    "Microsoft.AspNet.Server.Kestrel": "1.0.0-beta8",
  "commands": {
    "web": "Microsoft.AspNet.Server.Kestrel"

With this in place you can simply run from the commandline by typing dnx web. I really like that the plumbing for this has become so straight forward, and that we now have a good and simple story for running ASP.NET on a web server directly from the commandline, no matter if we are actually working cross-platform or not.

Who am I?

My name is Christian Holm Diget, and I work as an independent consultant, in Denmark, where I write code, give advice on architecture and help with training. On the side I get to do a bit of speaking and help with miscellaneous community events.

Some of my primary focus areas are code quality, programming languages and using new technologies to provide value.

Microsoft Certified Professional Developer

Microsoft Most Valuable Professional

Month List

bedava tv izle