Hosting ASP.NET Core App using Http.Sys (Web-listener)

In this post, we are going to discuss how to host ASP.NET Core app using HTTP.Sys aka web-listener. HTTP.sys is useful for deployments where you need to expose the server directly to the Internet without using IIS.

HTTP.sys is a good choice for internal deployments when you need a feature not available in Kestrel, such as Windows authentication. Therefore, in this case, I have changed my program file like shown below

Also, you need to install “Microsoft.AspNetCore.Server.HttpSys” library to make use of it. Its a pretty Straight Forward thing. Here, I am basically saying use this particular URL with other http.sys options like authentication, max connection, max size. You can learn more about http.sys options at this link. Having said that, for testing from visual studio, make sure you don’t run this under IIS-Express/IIS profile. Select profile like

You can always rename the profile from launchsettings.json file like shown below.

With that being said, when I run the app, it will open a console window like

Now, If I go to URL like http://localhost:7000/api/employee, it will produce results like shown below.

Now, this is fine with local testing. However, we can publish the same using dotnet publish command and then later on navigate to that folder and run like shown below.

This will also produce the same result while navigating. I hope you would have liked this discussion. In coming section, we will delve further. Till then stay tuned and Happy Coding.


1,440 total views, 2 views today