如何修复Windows服务错误1053? [英] How to fix windows service error 1053?

查看:876
本文介绍了如何修复Windows服务错误1053?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

错误1053:服务没有及时响应启动或控制请求 - 尝试启动服务器服务时。







如何解决以上错误



我尝试过:



我已经增加了注册表中的超时但它无法正常工作

解决方案

这意味着您的服务启动时间过长。你还没有发布任何代码,所以这是不可能的,但我会猜测你在服务的开始事件中有一个睡眠循环。如果是这种情况,那么这不是你编写服务的方式,start事件应该只初始化它并创建一个实际工作完成的线程,然后需要完成start事件。谷歌如何编写服务,你会找到初学者模板。



如果不是问题,你需要发布一些相关的代码。

您可能还将您的真实启动代码放在该启动事件中。您的处理应该在一个单独的线程中。你的主线程只响应事件。在启动的情况下,睡眠不是一个坏的东西,如果它很短并且在一个循环中响应服务管理器你还在使用它。 (显然,当启动完成时,睡眠应该是信号量的超时信号。)



有可能再次将你的处理放在另一个线程中并且有开始事件只是回答是的......完成了!。


Error 1053: The service did not respond to the start or control request in a timely fashion - When trying to start the server service.



how to fix above error

What I have tried:

I have increased the timeout in registry but its not working

解决方案

It means your service is taking too long to start. You haven't posted any code so it's impossible to tell, but I'm going to take a guess that you have a sleep loop in the start event of your service. If that's the case then that is not how you write a service, the start event should only initialise it and create a thread that the actual "work" is done on, and the start event then needs to complete. Google how you write a service and you'll find starter templates.

If that isn't the issue you'll need to post some relevant code.


You may also have put your real startup code in that start event. Your processing should be in a separate thread. Your main thread just responds to events. In the startup case, sleep is not a "bad" thing if it is short and in a loop to respond to the service manager that you are still working on it. (Obviously the sleep should be a timeout on a semaphore that is signaled when the startup has completed.)

A possibility is again to have your processing in another thread and have the start event just respond "Yup... got'r done!".


这篇关于如何修复Windows服务错误1053?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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