In the blog post Announcing ASP.NET Core 1.1 Preview 1 they announced a pre-release of
“WebListener is a server that runs directly on top of the Windows Http Server API. WebListener gives you the option to take advantage of Windows specific features, like support for Windows authentication, port sharing, HTTPS with SNI, HTTP/2 over TLS (Windows 10), direct file transmission, and response caching WebSockets (Windows 8). On Windows you can use this server instead of Kestrel by referencing the Microsoft.AspNetCore.Server.WebListener package instead of the Kestrel package and configuring your WebHostBuilder to use Weblistener instead of Kestrel:” its Github repository
I would like to ask you, if you have done any test with it , OR if you can confirm, based on your experience, that it will be possible to use a ServiceStack self-hosted app with Razor and Js front-end, as an UWP application (installed from Windows Store). Something like the example of servicestack gap, (only in this case we will not be able to use server-sent events, because UWP WebView uses the Edge). But I am interested for other applications in UWP.
ServiceStack runs on .NET Core 1.1 and it’s what all our .NET Core unit tests are running on but we’ve never tried using Web Listener. Also ServiceStack.Razor doesn’t work on .NET Core, we’ve had to create a new implementation based on MVC .NET Core as mentioned in the latest .NET Core release notes which are also available at: http://docs.servicestack.net/netcore-razor
I’ve never tried it but i’d say it’s unlikely you could run a self-hosted .NET Core Web Server in a UWP app or at least I’ve never heard anyone doing it. To run .NET Core Apps you need the .NET Core SDK installed which I find unlikely would let you deploy a self-contained .NET Core server runtime within a UWP app.
Microsoft updated their answer in a relevant Windows dev platform User’s Voice idea
"HttpListener is part of .NET Standard 2.0. Once UWP will be updated to support .NET Standard 2.0, it will gain this capability. I don’t believe we’ve shared any timelines for this update on UWP yet.
Immo Landwerth,
Program Manager .NET"
I suspect that WebListener server for ASP.NET Core will be part of the solution.
The UWP development is not an immediate issue, but as development’s decision and future direction, it would be important to be able to use ServiceStack selfhosted in a UWP application.
I tried to use WebListener in debugging according to Microsoft docs for WebListerner , avoiding the IIS Express. I installed the Microsoft.Net.Http.Server and Microsoft.Extensions.CommandLine.
and I changed the Main function, according to docs. Main for WebListerner.
I have 2 demos, one in ASP.Net Core 1.1 and the other is the RazorRockStars both in VS2017 RC, both running smoothly in IIS Express. When I am testing them, the Core demo runs in WebListener but the RazorRockStars raises an exception from WebListener that
" The process cannot access the file because it is being used by another process"
By the way, as you prepare benchmarks in different enviroments, as far as I know, I would be very interested if you could compare IIS vs WebListener in Windows.