windows服务启动超时
有没有办法为每个服务的服务启动超时设置不同的值?我可以使用 ServicesPipeTimeout 注册表项更改它,但它是针对每台机器的 (http://support.microsoft.com/kb/824344).
Is there a way to set a different value for service startup timeout per service? I can change it using the ServicesPipeTimeout registry key, but it's per machine (http://support.microsoft.com/kb/824344).
目前我唯一想到的就是在不同的线程中完成所有耗时的启动操作.
At the moment the only thing I thought about was to do all the time-consuming startup actions in a different thread.
尽快完成服务的启动是一种很好的做法.因此,在 start 状态期间,只执行您绝对需要确认它已成功启动的操作;剩下的事以后再做.如果开始仍然是一个漫长的过程,请使用SetServiceStatus 定期通知服务控制管理器您尚未完成,因此它不会使您的服务超时.
It's good practice to finish starting your service as fast as possible. So, during the start state, do only what you absolutely need to acknowledge it started successfully; and do the rest later. If the start is still a lengthy process, use SetServiceStatus periodically to inform the Service Control Manager that you have not yet finished, so it does not time-out your service.