Windows服务将无法重新启动后自动启动 [英] Windows Service won't automatically start after reboot

查看:618
本文介绍了Windows服务将无法重新启动后自动启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我自动启动Windows服务启动失败只有在重新启动。我通过维克斯在C#创建和安装一个Windows服务创建安装程序。该服务被设置为自动启动。该服务已安装并在NT AUTHORITY \ NETWORK SERVICE运行。当开始服务时,它首先使外部Web服务呼叫。

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 call.

在Windows 7中,我可以设置服务为自动 - 延时启动,该服务将开始在重新启动没有问题。但是,此选项是无法在Windows XP中使用,而当设置为自动启动,该服务由于失败

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

超时已达到(30000毫秒),而等待的MyService服务进行连接。

如果我尝试登录过程后,手动启动,该服务启动正常,只有当该服务试图自动启动在重新启动时,有一个问题,导致我相信有,我需要添加依存服务我的服务是正常启动。

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?

推荐答案

您可能有一个竞争条件与依赖。你可以解决这个通过配置为您服务,对其他服务的依赖可能是补丁(比如TCP / IP),但我真正要做的就是改写为您服务,并不需要启动的临界增长执行路径时进行此调用。它应改为定期尝试做在以后的Web服务调用,并记录有用的信息,或将消息发送到任务栏工具或类似的,如果有一个需要解决的问题。

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.

这篇关于Windows服务将无法重新启动后自动启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆