【问题标题】:Is there a way to increase windows service startup timeout for a specific service?有没有办法增加特定服务的 Windows 服务启动超时?
【发布时间】:2018-07-24 10:02:43
【问题描述】:

我需要增加我的一项 Windows 服务 (startup=automatic) 的启动超时,以便能够在重新启动后启动它。如果我手动启动或使用startup=delayed 类型,它会正常启动,但我想保留它automatic 我可以通过更改ServicesPipeTimeout 注册表项来增加它,但这会增加所有 Windows 服务的超时时间,而我只想为一项特定服务这样做。

另一种解决方案是在我的OnStartup 方法中使用RequestAdditionalTime 我在这里找到了 windows service startup timeout, 然而,它再次不适合我,因为似乎OnStart 甚至根本没有运行,可能 Windows 需要一些时间来加载不同的 dll 在启动服务之前,并且在 PC 重新启动后 30 秒是不够的。

是否有另一种方法可以设置其他一些注册表键值来增加仅一个服务的超时?

【问题讨论】:

标签: c# windows-services timeout startup


【解决方案1】:

You can modify the timeout value in the registry.


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.

【讨论】:

  • 这个方法会增加所有服务的超时时间,但是我只需要对一个特定的服务这样做,而其他的保持不变。
  • @MykhailoSeniutovych 您好,您找到解决问题的方法了吗?
猜你喜欢
  • 1970-01-01
  • 2010-09-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-04-19
  • 2016-07-26
  • 2013-06-23
  • 1970-01-01
相关资源
最近更新 更多