How to use HTTP.sys with ASP.NET Core applications

Posted: (EET/GMT+2)

 

When you host ASP.NET Core applications on Windows, using IIS is no longer the only choice. There's another option called HTTP.sys. This is the same kernel-mode HTTP server used by IIS itself. It's lightweight, high-performance, and great for scenarios where you don't need the full IIS feature set.

To use it, first install the package:

dotnet add package Microsoft.AspNetCore.Server.HttpSys

Then, configure it in your Program.cs or Startup.cs file:

var builder = WebApplication.CreateBuilder(args);
builder.WebHost.UseHttpSys(options =>
{
    options.UrlPrefixes.Add("http://localhost:8080");
});
var app = builder.Build();
app.MapGet("/", () => "Hello from HTTP.sys!");
app.Run();

HTTP.sys runs directly on top of the Windows networking stack. It supports HTTPS, Windows Authentication, and advanced features like kernel-mode caching and connection limits, all without requiring IIS to be installed.

This can be especially useful for self-hosted services, or for deploying internal tools where IIS configuration might be overkill. HTTP.sys also works well with Windows Services if you want your app to run without user interaction.

Do note that HTTP.sys is Windows-only. For cross-platform hosting, Kestrel remains the default and most portable option. But for local or enterprise use, HTTP.sys gives you the robustness of IIS with much less setup.