开发者

Windows Service won't automatically start after reboot [duplicate]

This question already has answers here: "A timeout was reached while waiting for the service to connect" error after rebooting (6 answers) Closed 9 years ago.

My automatically starting windows service fails to start only on reboot. I have a windows service created in C# and installed via a Wix created installer. The service is set up to start automatically. The service is installed and run under the NT AUTHORITY\NETWORK SERVICE. When the service is started, it first makes an external web services ca开发者_Python百科ll.

In Windows 7 I can set the service to be Automatic - Delayed start and the service will start on reboot no problem. However, this option is not available in Windows XP, and when set to Automatic start, the service fails due to

A timeout was reached (30000 milliseconds) while waiting for the MyService service to connect.

If I try to start manually after the login process, the service starts fine, it is only when the service tries to auto start on reboot that there is an issue, leading me to believe there are dependency services that I need to add to my service for it to start correctly.

Can anyone point me to the correct dependencies or an alternative approach?


You likely have a race condition with a dependency. You could probably patch around this by configuring your service to have a dependency on another service ( say tcp/ip ) but what I'd really do is rewrite your service to not need to make this call during the criticial execution path of startup. It should instead periodically attempt to make the webservice call at a later point and log useful messages or send messages to a taskbar utility or similar if there is a problem that needs to be addressed.


I had the same issue on 4 new servers. I set the W32 service to delay automatic and it solved the issue.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜