ASP.NET Core applications use a web server to receive HTTP requests, process connections, and forward requests to the application pipeline. Kestrel is the default web server in ASP.NET Core and is widely used for applications running on Windows, Linux, and macOS.
However, some Windows-based applications have requirements that make HTTP.sys a better option. These requirements may include Windows Authentication, port sharing, kernel-mode request handling, or direct file transmission.
Moving an ASP.NET Core application from Kestrel to HTTP.sys is not simply a configuration change. It affects how the application listens for requests, manages ports, handles authentication, configures HTTPS, and interacts with the Windows operating system.
In this article, we will understand the differences between Kestrel and HTTP.sys, explore how to migrate an existing ASP.NET Core application, and discuss the practical considerations developers should evaluate before making this change.
Understanding Kestrel and HTTP.sys
Before migrating an application, it is important to understand how these two web servers work.
What Is Kestrel?
Kestrel is the default, cross-platform web server for ASP.NET Core. It handles incoming HTTP requests and passes them to the ASP.NET Core middleware pipeline.
Kestrel can run independently or work behind a reverse proxy such as IIS, Nginx, or Apache.
For example, an application hosted directly on Kestrel can receive requests from clients without requiring an additional web server.
Its major advantages include:
- Cross-platform support.
- Good performance and memory utilization.
- Programmatic configuration of ports and HTTPS.
- Support for modern HTTP protocols.
- Flexibility when deploying applications across different environments.
Kestrel is generally the preferred choice for most ASP.NET Core applications.
What Is HTTP.sys?
HTTP.sys is a Windows-only HTTP server implementation built on the Windows HTTP Server API and kernel-mode HTTP.sys driver.
Unlike Kestrel, HTTP.sys uses Windows operating system capabilities to handle incoming HTTP traffic.
It can receive requests directly without requiring IIS or another reverse proxy.
HTTP.sys provides several capabilities that are particularly useful in Windows environments:
- Windows Authentication with kernel-mode support.
- Port sharing between applications.
- HTTPS support with Server Name Indication (SNI).
- Direct file transmission.
- Response caching.
- Customizable security descriptors.
- Integration with Windows networking infrastructure.
One important limitation is that HTTP.sys cannot be used with the ASP.NET Core Module or IIS Express.
Kestrel vs. HTTP.sys: What Actually Changes?
Both servers provide the infrastructure required to host ASP.NET Core applications, but their internal implementations and operating system dependencies are different.
Feature | Kestrel | HTTP.sys |
|---|---|---|
Platform support | Cross-platform | Windows only |
Request handling | User-mode server | Windows kernel-mode HTTP infrastructure |
Windows Authentication | User-mode authentication | Kernel-mode authentication support |
Port sharing | Not supported in the same way | Supported |
HTTPS configuration | Programmatic configuration | Windows HTTP SSL configuration |
Reverse proxy | Supported | Usually not required |
Direct file transmission | No equivalent server feature | Supported |
Response caching | Application-level caching options | Kernel-mode response caching support |
Deployment flexibility | High | Windows-dependent |
IIS integration | Supported through hosting models | Not compatible with ASP.NET Core Module |
The biggest difference is where HTTP request handling happens and which capabilities are provided by the operating system.
With Kestrel, developers have greater control over application-level server configuration. With HTTP.sys, several networking responsibilities are handled by Windows.
When Should You Move From Kestrel to HTTP.sys?
Switching web servers should be based on an actual application requirement rather than assuming that one server is always better.
Consider HTTP.sys in the following situations.
When You Need Windows Authentication
Some enterprise applications run inside corporate networks where users authenticate through Windows accounts.
HTTP.sys supports kernel-mode Windows Authentication, which can be useful when integrating ASP.NET Core applications with existing Windows authentication infrastructure.
For example, an internal employee portal may need to authenticate users through their domain accounts without requiring them to enter separate application credentials.
When Multiple Applications Need to Share a Port
HTTP.sys supports port sharing through its URL registration and request queue infrastructure.
This can be useful when multiple Windows applications need to register different URL prefixes while using the same network port.
For example, two applications might listen on different URL paths:
- http://localhost:5000/inventory/
- http://localhost:5000/orders/
The applications can register their respective URL prefixes with HTTP.sys, subject to URL reservation and configuration requirements.
When You Need Kernel-Level HTTP Features
HTTP.sys provides capabilities such as direct file transmission and kernel-mode response caching.
These features can be useful for applications with specific Windows hosting requirements.
However, developers should evaluate whether the application actually benefits from these capabilities before changing the hosting infrastructure.
Migrating an ASP.NET Core Application From Kestrel to HTTP.sys
Let's walk through a practical migration.
Assume we have an existing ASP.NET Core Web API that uses Kestrel.
Step 1: Review the Existing Kestrel Configuration
A typical ASP.NET Core application uses Kestrel automatically.
The following example shows a basic configuration:
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllers();
var app = builder.Build();
app.MapControllers();
app.Run();The application uses Kestrel by default unless another hosting configuration is selected.
You might also have additional Kestrel configuration in your application:
builder.WebHost.ConfigureKestrel(options =>
{
options.ListenAnyIP(5000);
options.Limits.MaxRequestBodySize =
50 * 1024 * 1024;
});When migrating to HTTP.sys, review these settings carefully.
Kestrel-specific configuration does not automatically transfer to HTTP.sys. You must identify which settings have equivalent HTTP.sys options and which require a different implementation.
Step 2: Configure HTTP.sys
ASP.NET Core provides the UseHttpSys() extension method to configure HTTP.sys as the web server.
The following example shows how to modify the application:
using Microsoft.AspNetCore.Server.HttpSys;
var builder = WebApplication.CreateBuilder(args);
builder.WebHost.UseHttpSys(options =>
{
options.UrlPrefixes.Add("http://localhost:5000");
options.MaxConnections = 100;
options.MaxRequestBodySize = 50 * 1024 * 1024;
});
builder.Services.AddControllers();
var app = builder.Build();
app.MapControllers();
app.Run();Here is what the configuration does:
- UrlPrefixes defines the URL prefixes that HTTP.sys should listen on.
- MaxConnections controls the maximum number of concurrent connections.
- MaxRequestBodySize defines the maximum request body size.
These settings should be selected according to the application's expected workload.
For example, an internal API that processes document uploads may require a larger request body limit than a simple authentication API.
Unlike Kestrel, HTTP.sys relies on Windows URL registration and related operating system configuration.
Step 3: Configure URL Reservations
One important difference developers encounter during migration is URL access permissions.
HTTP.sys requires URL prefixes to be registered with the Windows HTTP Server API.
For non-administrator application accounts, administrators may need to create a URL reservation.
For example, an administrator can execute the following command:
netsh http add urlacl `
url=http://localhost:5000/ `
user=DOMAIN\ServiceAccountThis command grants the specified Windows account permission to register the URL prefix.
In production, replace the example account with the actual service identity.
Avoid running the application with administrator privileges simply to bypass URL reservation problems.
Step 4: Configure HTTPS
HTTPS configuration also changes when moving to HTTP.sys.
With Kestrel, developers commonly configure certificates directly through application configuration or code.
HTTP.sys uses Windows HTTP SSL certificate bindings.
For example, an administrator can configure an HTTPS certificate binding using:
netsh http add sslcert `
ipport=0.0.0.0:5001 `
certhash=YOUR_CERTIFICATE_THUMBPRINT `
appid="{YOUR-APPLICATION-GUID}"The certificate must already be installed in the appropriate Windows certificate store.
The certificate thumbprint and application identifier must be replaced with valid values.
For production deployments, ensure that the certificate is correctly installed, its private key is accessible to the required operating system components, and the binding matches the application's HTTPS endpoint.
Step 5: Configure Windows Authentication
One of the main reasons developers consider HTTP.sys is its Windows Authentication support.
The following example enables Windows Authentication:
using Microsoft.AspNetCore.Server.HttpSys;
using System.Net;
var builder = WebApplication.CreateBuilder(args);
builder.WebHost.UseHttpSys(options =>
{
options.UrlPrefixes.Add("http://localhost:5000");
options.Authentication.Schemes =
AuthenticationSchemes.NTLM |
AuthenticationSchemes.Negotiate;
options.Authentication.AllowAnonymous = false;
});
builder.Services.AddAuthentication(
HttpSysDefaults.AuthenticationScheme);
builder.Services.AddAuthorization();
var app = builder.Build();
app.UseAuthentication();
app.UseAuthorization();
app.MapGet("/profile", (HttpContext context) =>
{
return Results.Ok(new
{
UserName = context.User.Identity?.Name,
IsAuthenticated = context.User.Identity?.IsAuthenticated
});
}).RequireAuthorization();
app.Run();This configuration enables the selected Windows authentication schemes and prevents anonymous requests at the HTTP.sys authentication level.
The application also registers authentication and authorization middleware to enforce access rules.
In production, review the authentication requirements, supported clients, domain configuration, and security policies before enabling these schemes.
Important Configuration Differences During Migration
Not every Kestrel setting has a direct HTTP.sys equivalent.
Developers should review the existing configuration instead of copying settings from one server to another.
Configuration Area | What Changes |
|---|---|
Listening endpoints | Configure HTTP.sys URL prefixes |
HTTPS certificates | Configure Windows HTTP SSL bindings |
Authentication | Use HTTP.sys authentication options where appropriate |
Connection limits | Review HTTP.sys connection settings |
Request size limits | Configure supported HTTP.sys limits |
Port management | Consider URL reservations and port sharing |
Reverse proxy | Reevaluate whether an external proxy is required |
Hosting environment | Ensure deployment runs on supported Windows infrastructure |
Another important consideration is application behavior behind reverse proxies.
If your application previously depended on forwarded headers from IIS or Nginx, review the middleware configuration after migration.
Do not assume that forwarded headers, original client IP addresses, or request scheme information will behave exactly as they did in the previous deployment.
Advantages and Disadvantages of HTTP.sys
Advantages
HTTP.sys provides several benefits for Windows-based applications.
- Native Windows Authentication: Supports kernel-mode Windows Authentication, which can simplify integration with enterprise environments.
- Port sharing: Multiple applications can register different URL prefixes on the same port.
- Direct file transmission: Supports sending files through Windows HTTP infrastructure.
- Kernel-mode response caching: Can serve eligible cached responses without processing every request through the application.
- Windows integration: Uses established Windows HTTP infrastructure and operating system security capabilities.
Disadvantages
HTTP.sys also introduces limitations that developers should understand.
- Windows dependency: Applications cannot use HTTP.sys as their web server on Linux or macOS.
- Additional configuration: URL reservations and HTTPS bindings require Windows-level configuration.
- Deployment complexity: Server administrators may need to manage permissions, certificates, and URL registrations.
- IIS incompatibility: HTTP.sys cannot be hosted through the ASP.NET Core Module.
- Different configuration model: Existing Kestrel-specific settings may need to be redesigned.
For applications that do not require HTTP.sys-specific capabilities, Kestrel generally remains the simpler choice.
Common Migration Mistakes
Assuming Kestrel Configuration Works Automatically
Kestrel-specific settings such as endpoint configuration and transport options do not automatically apply to HTTP.sys.
Review each configuration option and identify its HTTP.sys equivalent before deployment.
Ignoring URL Reservation Permissions
An application may work when executed with elevated permissions but fail when deployed under a restricted Windows service account.
Configure URL reservations for the actual service identity.
Forgetting HTTPS Certificate Bindings
An application that previously loaded its HTTPS certificate through Kestrel configuration may fail after switching to HTTP.sys.
Check the Windows SSL certificate binding and certificate installation before starting the application.
Expecting HTTP.sys to Work With IIS Hosting
HTTP.sys is an alternative hosting server, not a replacement that can be selected inside the ASP.NET Core Module.
If your application depends on IIS integration, review the hosting architecture before migration.
Troubleshooting Common Problems
Problem | Possible Cause | Recommended Solution |
|---|---|---|
Access denied when starting the application | Missing URL reservation | Configure URL ACL permissions |
Address already in use | Conflicting URL registration or listener | Inspect existing HTTP.sys registrations |
HTTPS connection fails | Missing or incorrect SSL binding | Verify certificate installation and binding |
Windows Authentication fails | Incorrect authentication configuration | Review authentication schemes and domain settings |
Application does not start | Unsupported hosting configuration | Verify HTTP.sys configuration and Windows support |
Requests fail behind a proxy | Incorrect forwarded-header configuration | Review proxy and forwarded-header settings |
Windows provides useful commands for inspecting HTTP.sys configuration.
For example:
netsh http show urlaclThis displays registered URL reservations.
To inspect SSL certificate bindings, use:
netsh http show sslcertThese commands are useful when diagnosing deployment problems because they help identify operating system configuration issues that are not visible in the ASP.NET Core application logs.
Best Practices for Production Deployments
Before deploying an HTTP.sys-based application, consider the following practices.
- Validate the Windows environment. Ensure that the operating system supports the target ASP.NET Core runtime and the HTTP.sys features your application requires.
- Use dedicated service accounts. Avoid running production applications under administrator accounts.
- Configure URL reservations explicitly. Grant access only to the required URL prefixes and service identities.
- Manage certificates carefully. Monitor certificate expiration, validate HTTPS bindings, and establish a certificate renewal process.
- Review authentication requirements. Enable only the authentication schemes required by the application.
- Monitor HTTP.sys and application logs. Investigate connection failures, authentication errors, request timeouts, and application exceptions separately.
- Test under production-like conditions. Validate concurrent requests, large uploads, authentication, HTTPS, and application restarts before completing the migration.
- Maintain a rollback plan. Keep the previous hosting configuration available until the new deployment has been validated.
Summary
Moving an ASP.NET Core application from Kestrel to HTTP.sys changes more than the web server responsible for handling HTTP requests. It also changes how the application interacts with Windows networking infrastructure, manages URL registrations, configures HTTPS, and handles authentication.
Kestrel remains the recommended choice for most ASP.NET Core applications because of its cross-platform support, performance characteristics, and flexible configuration model.
HTTP.sys becomes a useful alternative when an application has specific Windows requirements, such as kernel-mode Windows Authentication, port sharing, direct file transmission, or kernel-mode response caching.
The most important part of a successful migration is understanding the differences before changing the hosting configuration. By reviewing server settings, configuring Windows permissions, validating HTTPS bindings, and testing the application under realistic deployment conditions, developers can move to HTTP.sys without introducing unnecessary hosting problems.

Join the conversation! Your thoughts help the community grow.