当我手动停止并关闭系统并打开时,Windows 服务未启动

问题描述 投票:0回答:1

目前我面临如下所述的问题

我有一堆后台服务,它们将使用以下配置注册到 Windows 服务。

常规选项卡信息

Startup Type: Automatic (Delayed Start)

恢复选项卡信息

First failure: Restart the Service

Second failure: Restart the Service

Subsequent failure: Restart the Service 

因此,通过上述配置,我的服务工作正常,并且我有一个用例,我将出于某种原因停止服务(手动和编程)。

问题陈述如下

When I manually stop the service and shutdown the system and waited for couple of minutes then turn on the system again waited for 15 min none of the service is started.

我花了很多时间来弄清楚,但到目前为止还没有运气,期待解决方案。

感谢您的阅读!

c# windows-services
1个回答
0
投票

也许有人不会接受我的答案,但坦率地说,如果有人觉得这不是一个好的解决方案,我很抱歉。

但真相如下。

当我使用 Automatic-Delay 设置服务类型以及 ServicesPipeTimeout 默认值 (30000 mSec) 和自定义值 60000 mSec 时,它们没有按预期工作。

自动延迟启动的原因是由于某些大数据处理的服务加载时间 - 我遇到的场景之一。

PS:

when I manually stop and shut down and turn on, service is not starting.

解决方案:

Increase the ServicesPipeTimeout value to 180000 mSec and the Service type is changed to Automatic. 

这就是发生在我身上的魔法。所有服务都开始按预期工作。

自动延迟启动有一些技术限制 - 我不确定限制是什么,也没有具体的文档。

我在以下操作系统中尝试的解决方案(Windows 10 Pro和Windows Server 2019)

感谢您的阅读!!!!

快乐编码:)

© www.soinside.com 2019 - 2024. All rights reserved.