启动windows服务的超时时间是多少?

2023-11-23

我已经部署了 Windows 服务(使用独立安装程序类和 SC.EXE),但是当我尝试启动它时出现错误:

---------------------------
Services
---------------------------
Could not start the MyName service on Local Computer.



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

什么是超时?感觉好像3秒左右。如果我的服务时间更长,我需要做什么?


在您的服务类别中,使用ServiceBase.RequestAdditionalTime()在您的 OnStart/OnStop 方法中:

// request an additional 4 seconds to complete the operation
RequestAdditionalTime(4000);  
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

启动windows服务的超时时间是多少? 的相关文章

随机推荐