我有一个 Windows 服务,当服务失败时我会为它设置恢复选项(通过服务应用程序,在服务属性的恢复选项卡中)。
当前设置的选项是在 15 Minutes 后进行第一次和第二次尝试重新启动,然后在一天后重置失败计数器。启动类型为自动延迟。
虽然这通常有效,但在重新启动后启动失败后我似乎没有进行任何重试。以下是 Windows 事件日志的摘录:
11.06.2020 02:18:28 The process C:\WINDOWS\system32\svchost.exe (S701028A) has initiated the restart of computer S701028A on behalf of user NT AUTHORITY\SYSTEM for the following reason: Operating System: Recovery (Planned) Reason Code: 0x80020002 Shutdown Type: restart Comment:
11.06.2020 02:20:11 The XYZ Service service entered the stopped state.
11.06.2020 02:20:16 The operating system is shutting down at system time 2020-06-11T00:20:16.361111600Z.
....
11.06.2020 02:20:19 The operating system started at system time 2020-06-11T00:20:19.490015600Z.
11.06.2020 02:24:10 The XYZ service failed to start due to the following error: The service did not respond to the start or control request in a timely fashion.
11.06.2020 02:24:10 A timeout was reached (30000 milliseconds) while waiting for the XYZ service to connect.
似乎恢复选项仅适用于进程退出,不适用于系统引导。系统启动后如何定义重试?
备注:操作系统名称 Microsoft Windows Server 2012 R2 标准版 6.3.9600 Build 9600