Topshelf Service won't run as service, but runs fine as console app

Skip to first unread message

Nathan Risto

Jan 24, 2022, 1:32:51 PM1/24/22
to topshelf-discuss
I've spent days trying to resolve the cause of this with no avail. 

I've built a topshelf service, that runs fine from the command line, or even if I simply launch the exe from windows explorer.

However, once installed as a service, any attempt to start it then results in this:

Configuration Result:
[Success] Name Consumer.Service.NetFramework
[Success] ServiceName Consumer.Service.NetFramework
Topshelf v4.3.0.0, .NET Framework 4.8.4420.0 (4.0.30319.42000)
Topshelf.Hosts.StartHost Error: 0 : The service failed to start., System.InvalidOperationException: Cannot start service Consumer.Service.NetFramework on computer '.'. ---> System.ComponentModel.Win32Exception: The service did not respond to the start or control request in a timely fashion
   --- End of inner exception stack trace ---
   at System.ServiceProcess.ServiceController.Start(String[] args)
   at Topshelf.Runtime.Windows.WindowsHostEnvironment.StartService(String serviceName, TimeSpan startTimeOut)
   at Topshelf.Hosts.StartHost.Run()
PS D:\services\Service.NetFramework>

I've tried changing the permissions as well as just about anything I can think of, but nothing allows it to run.
Reply all
Reply to author
0 new messages