Special thanks to Mr.Tom Dykstra from Microsoft for suggesting some points for this post.
Web Listener is now available on Nuget.
First of all, what is Web Listener?
Web Listener is one of the servers of .Net core.
ASP.NET Core is completely decoupled from the web server environment that hosts the application. ASP.NET Core supports hosting in IIS and IIS Express, and self-hosting scenarios using the Kestrel and WebListener HTTP servers.
As per the .Net team says
WebListener is a Windows HTTP server built on the Http.Sys kernel mode driver. It exposes a number of Http.Sys features previously only availabe in IIS.
Fine, but when should we use Web Listener?
If you are on Windows and if you want to expose your server directly to the internet. Because Kestrel is not certified for direct exposure.
Or you need any of the features listed below:
- Windows Authentication
- Port sharing
- HTTPS with SNI
- HTTP/2 over TLS (Windows 10)
- Direct file transmission
- Response caching
It is also Recommended for edge deployment because it’s built on the existing Http.Sys HTTP stack. Http.Sys is mature technology that protects against many kinds of attacks. Kestrel is newer, hasn’t had a chance to develop as many protective features yet.
NOTE: Please note that it is Not compatible with ASP.NET Core Module, so can’t be used with IIS even if you wanted to.
- Can use Kestrel for internal micro service to micro service communications on private network (kestrel faster), should use WebListener for directly externally facing micro service layer.
- If a cluster is not on a closed private virtual network, should use WebListener for the inter-service communication as they are open to other things contacting them on their “internal” ports.
Great, and what are Supported Windows versions?
- Windows 7 and Windows Server 2008 R2 and later
So, How to get it via Nuget?
You can get it using below command:
Great, What to do after getting it from Nuget?
You can use it in code as shown below:
public static void Main(string args)
var host = new WebHostBuilder()
options.ListenerSettings.Authentication.Schemes = AuthenticationSchemes.NTLM;
options.ListenerSettings.Authentication.AllowAnonymous = false;
Awesome, anything extra needed to use WebListener?
Yes, below are few points I got from Mr.Tom Dykstra:
- Specify options in Http.sys registry keys
- Register prefixes so you don’t have to run the app as admin
- Set up SSL certificates
- Don’t run in IIS
- In VS the default launch profile is for IIS Express, but you can change it to the alternate console profile.