7

我有一个使用 EasyNetQ 和 RabbitMQ 的 Windows 服务。服务从服务控制管理器正常启动。但是,我偶尔会在重新启动时看到,服务不会以服务事件日志中的错误启动:

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.

我试过自动延迟服务,但没有帮助。

此外,我正在考虑设置恢复机制,以便如果它没有启动,它会在第一次/第二次和后续故障时重新启动。不确定这是否可行。

所以我的问题是如何确定导致我的服务有时无法启动的依赖关系?

4

1 回答 1

0

为了确定导致错误的依赖项,您可以尝试在 TopShelf“OnException”(https://topshelf.readthedocs.io/en/latest/configuration/config_api.html#oneexception)上附加一个处理程序并记录异常导致错误。

于 2018-04-07T23:11:41.727 回答