有没有一种方法可以增加特定服务的Windows服务启动超时时间?

3
我需要增加一个Windows服务的启动超时时间(startup=automatic),以便在重新启动后能够启动它。如果我手动启动它或使用startup=delayed类型,则它会正常启动,但我想保持它为automatic。我可以通过更改ServicesPipeTimeout注册表键来增加它,但这将增加所有Windows服务的超时时间,而我只想对一个特定的服务进行操作。
另一种解决方案是在我的OnStartup方法中使用RequestAdditionalTime,我在这里找到了它windows service startup timeout,但它似乎不适合我,因为似乎OnStart根本没有运行,可能是因为Windows需要一些时间来加载不同的dll,然后在PC重新启动后30秒就不够了。
也许有另一种方法,可以设置一些其他的注册表键值,仅增加一个服务的超时时间?

这可能会对你有所帮助:https://dev59.com/TnVC5IYBdhLWcg3wrDNd - undefined
1个回答

2

您可以在注册表中修改超时值


1. Click Start, click Run, type regedit, and then click OK.
2. Locate and then click the following registry subkey:
 - HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control
3. In the right pane, locate the ServicesPipeTimeout entry.

**Note**: If the ServicesPipeTimeout entry does not exist, you must create it. To do this, follow these steps:

 - On the Edit menu, point to New, and then click DWORD Value.
 - Type ServicesPipeTimeout, and then press ENTER. 
4. Right-click ServicesPipeTimeout, and then click Modify.
5. Click Decimal, type 60000, and then click OK.
 - This value represents the time in milliseconds before a service times out.
6. Restart the computer.


这个方法会增加所有服务的超时时间,但我只需要针对一个特定的服务进行调整,其他服务不变。 - undefined
@MykhailoSeniutovych 你好,你找到解决这个问题的方法了吗? - undefined
@MykhailoSeniutovych 我也遇到了同样的问题。 - undefined

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接