Topshelf service with dependency on RabbitMQ not starting on reboot
Asked Answered
M

1

7

I have a windows services which uses EasyNetQ and RabbitMQ. The service starts normally from the service control manager. However I have seen occasionally on a reboot, the service does not start with the error in the services event log :

A timeout was reached (30000 milliseconds) 

The <serviceName> service failed to start due to the following error: 
The service did not respond to the start or control request in a timely fashion.

I have tried auto delaying the service and this has not helped.

In addition, I was thinking about setting the recovery mechanism so that if it does not start it restarts on first/second and subsequent failures. Not sure if this will work.

So my questions is how can I determine what the dependency is that is causing my service not to start sometimes?

Muumuu answered 13/10, 2014 at 19:5 Comment(1)
Is RabbitMQ installed on the same server? If yes, have you tried to use DependsOn method while building your service using topshelf? If RabbitMQ and your service are on the same machine, there is a possibility that your services will try to start before RabbitMQ is up and running.Catechism
S
0

In order to determine what dependency is causing the error you could try to attach a handler on TopShelf "OnException" (https://topshelf.readthedocs.io/en/latest/configuration/config_api.html#onexception) and log the exception that caused the error.

Spew answered 7/4, 2018 at 23:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.