"在等待服务来连接&QUOT超时达成;重启后的错误 [英] "A timeout was reached while waiting for the service to connect" error after rebooting

查看:291
本文介绍了"在等待服务来连接&QUOT超时达成;重启后的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我运行了许多的Hyper-V虚拟机自定义编写的Windows服务。该虚拟机得到重新启动一小时几次,因为有些自动化测试正在运行的一部分。该服务设置为自动启动,几乎所有的时间,它启动的罚款。

I have a custom-written Windows service that I run on a number of Hyper-V VMs. The VMs get rebooted a couple times an hour as part of some automated tests being run. The service is set to automatic start and almost all of the time, it starts up fine.

不过,也许5%的时候,没有模式,我可以看出,该服务将无法启动。当它失败时,我得到在事件查看器的错误说

However, maybe 5% of the time, with no pattern that I can discern, the service fails to start. When it fails, I get an error in Event Viewer saying

一个超时达到(30000毫秒),而等待我的服务名称服务来连接。

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

当这种情况发生时,我可以手动启动该服务,或再次重新启动,并且该服务将启动罚款。

When this occurs, I can start the service manually, or restart again, and the service will start fine.

我想不通的事情是,30秒超时没有出现在我的code要发生。我的服务类公司的OnStart()方法日志的第一行启动...到log4net的日志。当服务无法启动​​,我甚至不得到任何记录的所有,这表明,我认为无论是log4net的无法登录无论出于何种原因,或超时我的OnStart前发生的()被调用。

The thing I can't figure out is that the 30 second timeout doesn't appear to be occurring in my code. The very first line of my service class's OnStart() method logs "Starting..." to its log4net log. When the service fails to start, I don't even get anything logged at all, which indicates to me that either log4net can't log for whatever reason, or the timeout is occurring before my OnStart() gets called.

该服务运行在各种操作系统中,从XP一路攀升到Win7和2008R2,我知道该服务设置为延迟启动可能会解决这个对于Vista和更高版本,但是这似乎是一个黑客。

The service runs on a variety of OSes, from XP all the way up to Win7 and 2008R2, and I know that setting the service to delayed start may solve this for Vista and later, but that seems like a hack.

我一直没能远程调试这一点,因为一个事实,即它发生这样间歇性和系统启动过程中,我不知所措,进一步的方法,试图找出发生了什么事情。任何想法?

I haven't been able to remote debug this because of the fact that it happens so intermittently and during system startup, and I'm at a loss as to further ways to try to figure out what's going on. Any ideas?

推荐答案

您可能想看看这个帖子,它不等同于您的情况,但解决方案并在Windows服务和启动功能提供了中肯的意见。

You may want to look at this post, it's not identical to your situation but the solution does offer sound advice on Windows services and startup functionality.

这篇关于"在等待服务来连接&QUOT超时达成;重启后的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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