Starting a service crashes on Windows 2008R2 server

586 views
Skip to first unread message

Christos Delivorias

unread,
Apr 17, 2015, 11:55:57 AM4/17/15
to topshelf...@googlegroups.com
Hey guys,

weird error I'm seeing. I've written a monitoring service that simply checks the health of the RabbitMQ cluster. While everything work fine in Debug, and also when I install the service on my Win7 dev machine, when I move over to installing it to a Win2008R2 server, things break when I try to start the service.
I can install the service, as an admin account user, and I can also run:

> service.exe run

and it works fine. But when I try

> service.exe start

I get the following error:

PS G:\.......\Release> .\service.exe start
Configuration Result:
[Success] Name service_name
[Success] DisplayName service display name
[Success] Description service description
[Success] ServiceName rabbitmq_cluster_monitor
Topshelf v3.1.135.0, .NET Framework v4.0.30319.18408
Topshelf.Hosts.StartHost Error: 0 : The service failed to start., System.InvalidOperationException: Cannot start service
 service_name on computer '.'. ---> System.ComponentModel.Win32Exception: The system cannot find the file specified
   --- End of inner exception stack trace ---
   at System.ServiceProcess.ServiceController.Start(String[] args)
   at System.ServiceProcess.ServiceController.Start()
   at Topshelf.Runtime.Windows.WindowsHostEnvironment.StartService(String serviceName, TimeSpan startTimeOut)
   at Topshelf.Hosts.StartHost.Run()

I don't get a different behaviour if I run:

PS G:\.......\Release> .\service.exe start --sudo

In fact it doesn't pop up the UAC to add credentials (I'm guessing since I'm already an admin?)

I don't understand what's special about this 2008 server.
I should mention that I'm running it as a LocalService via Topshelf.

Thanks,
Christos

Chris Patterson

unread,
Apr 17, 2015, 4:37:24 PM4/17/15
to topshelf...@googlegroups.com
I would guess that an assembly or something on the server/path where the service is installed on the server is missing. If you install it as a service and run it on your Windows 7 machine, does it work?

Are you using server.exe install on you Windows 2008 R2 server or installing it using another type of installer?


--
You received this message because you are subscribed to the Google Groups "topshelf-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to topshelf-discu...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

IanYates

unread,
Apr 18, 2015, 11:10:33 PM4/18/15
to topshelf...@googlegroups.com
Perhaps something is being loaded using a relative path, and the startup folder is different for the service versus when run from the command line?

I'd run SysInternals ProcMon and see what files are trying to be loaded on that server when it's working versus not working.  Hopefully things are mostly identical (apart from some service manager stuff) through to the point where something can't be found at the expected location (which may not be the location you thought it'd be searching in).

Let us know how you go :)

Christos Delivorias

unread,
Apr 20, 2015, 7:00:47 AM4/20/15
to topshelf...@googlegroups.com
It looks like the problem was me trying to install the service from a network drive. I guess apath was treated as relative somewhere and didn't resolve correctly.
Everything is fine now.

Thanks for the ideas guys, and pointing me towards checking paths.

C.
Reply all
Reply to author
Forward
0 new messages