c# - 有没有办法增加特定服务的 Windows 服务启动超时?
问题描述
我需要增加我的一个 Windows 服务(启动 = 自动)的启动超时,以便能够在重新启动后启动它。如果我手动启动它或使用startup=delayed
类型,它会正常启动,但我想保留它automatic
我可以通过更改ServicesPipeTimeout
注册表项来增加它,但这会增加所有 Windows 服务的超时,而我只想为一个特定的服务这样做。
另一个解决方案是RequestAdditionalTime
在我的OnStartup
方法中使用我在这里找到它
windows service startup timeout,但是它再次不适合我,因为它似乎OnStart
根本没有运行,可能 windows 需要一些时间来加载不同的 dll 在启动服务和 30 秒之前PC重新启动后还不够。
是否有另一种方法可以设置其他一些注册表键值来增加仅一个服务的超时?
解决方案
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.
推荐阅读
- python - 在熊猫数据框中按组行数删除组
- linux - 考虑到它的参数,如何检测 bash 脚本是否已经在运行
- hadoop - 为什么 HDFS 将文件拆分成块?
- r - 如何逐行计算匹配模式并满足某些条件的特定列的列积?
- python - 在 Python Zeep 中格式化 SOAP 数组
- flutter - 将流添加到 StreamZip 列表
- spring - Spring Cloud Kafka Streams 自动主题创建设置不起作用
- java - 错误 javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path while using ssl.insecure flag
- nginx - 如何根据 Lua 中的 capture_multi 按索引从表中获取值
- python - 如何将文件从 FileField 复制到另一个具有不同上传路径 Django 的 FileField?