Doc or guidance for putting ServiceStack into a .Net Core 3.0 GenericHost

I would like to run ServiceStack as a Windows service or Linux demon providing static file serving, and REST API endpoints, under .Net Core V3.0 (Preview 4 is the latest current release of the SDK as of this posting). The current MS documentation indicates that services and daemons should inherit from GenericHost. Is there any examples or documentation, yet, for running SS as a windows service under Net Core V3.0’s GenericHost?

ServiceStack just runs as ASP.NET Core middleware so should configure itself the same way into any .NET Core project:

https://docs.servicestack.net/netcore#apphostbase-net-core-module

Does it implement Microsoft.Extensions.Hosting.IHostedService?

Or perhaps I have a fundamental misunderstanding of SS Core. SS under .Net Framework provides AppSelfHostBase from which the AppHost class can be derived. Such an AppHost works fine as a standalone static file server and REST API server, without bringing along IIS or Kestrel (at least, I don’t think it does). Does SS Core have a similar capability?

My goal is a very small windows service or linux daemon, implemented in .Net Core for commonality, that can be installed on small devices with limited CPU/RAM, that can provide both REST APIs and static file serving. For that, I was hoping to only need SS Core, without dragging along Kestrel or IIS DLLs into the finished product.

No ServiceStack is just registered as Middleware the same way as MVC/WebApi is.

All .NET Web Apps require a Web Server, AppSelfHostBase in .NET FX is a self-host that uses HttpListener. AppSelfHostBase is also available for ASP.NET Core but it’s just a wrapper around Kestrel which is a self-host HTTP Server like HttpListener except leaner/faster and runs flawlessly x-plat (mono’s HttpListener wasn’t very good).

We use AppSelfHostBase for our multi-platform (i.e. .NETFX/.NETCore) integration tests, but I wouldn’t use it in your Apps as it’s just a wrapper around a built-in .NET Core’s WebHost and Startup configuration classes which makes it less flexible as your Apps would typically want to use their own Startup classes.

Independent of ASP.NET Core Apps (and middleware like SS/MVC/WebApi) are the web servers it runs on which you can read about here: Web server implementations in ASP.NET Core | Microsoft Learn

ASP.NET Core on Windows ships with the following:

  1. Kestrel server is the default, cross-platform HTTP server implementation.
  2. IIS HTTP Server is an in-process server for IIS.
  3. HTTP.sys server is a Windows-only HTTP server based on the HTTP.sys kernel driver and HTTP Server API.

.NET Framework’s HttpListener is also a wrapper around Windows HTTP.sys.

Again this is independent of ServiceStack, you can start with the .NET Core host you want to run and register ServiceStack in your App like any other middleware.

FYI a lightweight .NET Core template is selfhost which only references the Kestrel Server NuGet package and ServiceStack:

In contrast most .NET Core Apps reference Microsoft.AspNetCore.App NuGet metapackage which has a tonne of extra dependencies (see dependencies) list.

The NuGet dependencies are the only difference between the templates, which means you also don’t get the default conventions, i.e. you have to register everything you need like ContentRoot/WebRoot and configuration sources like appsettings.json, etc.

All .NET Core Apps are self-hosting HTTP Servers Console Apps which is what runs when you use dotnet run which launches your app on http://localhost:5000 by default.

Thank you for the extensive explanation. Now to go wrap my head around it, and start making adjustments to my projects.
My fundamental misunderstanding was, I thought SS AppSelfHostBase had its own independently developed static file web server implementation, I did not understand that it wrapped HttpListener. I will be updating my Blazor Demo examples on GitHub over the course of the next few days so that Demo06 and above will use .NETCore (V3.0 P4 or later). Again, I certainly appreciate your time in helping me!

ServiceStack does have its own static file server implementation but it doesn’t use its own Custom HTTP Server. HttpListener is available in the .NET Framework Base Class Libraries, which uses Windows HTTP.sys web server so Apps don’t need to distribute their own.