PeterKottas / DotNetCore.WindowsService

Simple library that allows one to host dot net core application as windows services. Perfect solution to power micro-services architecture.
MIT License
568 stars 150 forks source link

How to start service with a .Net Core 3.0 single file exe #129

Open nologinatgit opened 5 years ago

nologinatgit commented 5 years ago

I have created an ASP.NET Core 3.0 project and start it as a Windows service with your library. When I choose the conventional publishing in the Windows service project, it creates nearly 500 files and it can be started with this library and it serves the requests using the proper URLs.

However, when I choose the single exe as the publishing form, I get 1 file that is 175+ MB in size:

    <LangVersion>latest</LangVersion>
    <PublishReadyToRun>false</PublishReadyToRun>
    <PublishSingleFile>true</PublishSingleFile>
    <RuntimeIdentifier>win-x86</RuntimeIdentifier>

When I simply start it, I can see the following:

Starting up as a console service host The ... service is now running, press Control+C to exit.

Unfortunately, I can't see any OnStart, OnStop or OnError message in the log file.

Can I somehow use the single exe format and run it as a service?