Search code examples
asp.net-corehttp.sys

When self-hosting ASP.NET Core - does it use http.sys if available?


http.sys is a kernel-mode driver present in Windows that greatly speeds-up the processing and routing of incoming HTTP requests. It was added during the days of Windows NT 4 to give the then-nascant IIS a benchmark boost compared to Apache.

For those unfamiliar: it's a component that hijacks incoming HTTP requests (on port 80 and 443, you can configure it to monitor other ports too) and routes them to different userland applications based on its configuration, see MSDN for more details: https://msdn.microsoft.com/en-us/library/windows/desktop/aa364510(v=vs.85).aspx

Today, provided you use IIS to host your application, you'll be taking advantage of http.sys.

However, I can't find any information that states whether or not self-hosted ASP.NET Core applications will be using http.sys if present.


Solution

  • While Kestrel doesn't use or support http.sys (it must also run on Linux which doesn't have http.sys), you can use WebListener (also here, which uses http.sys and usage example here) to achieve this. However, only on Windows for obvious reasons.

    Unlike Kestrel, WebListener is considered production ready, which means you can use it to host internet facing applications. Kestrel on other side isn't there yet, so the official recommendation at the time of the wrtiting is to always use Kestrel behind a reverse proxy (IIS, nginx etc.).