DotNetCore.WindowsService icon indicating copy to clipboard operation
DotNetCore.WindowsService copied to clipboard

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

Open nologinatgit opened this issue 5 years ago • 0 comments

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?

nologinatgit avatar Oct 15 '19 09:10 nologinatgit