简体   繁体   中英

Is there a way to increase the timeout value for a single windows service in the registry in C#?

我目前正在执行以下操作,将服务管道值设置为注册表中的 DWord 文件,但是我希望仅通过注册表增加单个服务的超时时间。

servicesPipeTimeout.SetValue("ServicesPipeTimeout", 300000, RegistryValueKind.DWord);

If this is for your own service, you should call the api method for requesting additional time in class ServiceBase :

void RequestAdditionalTime(int milliseconds)

You can call this method in OnContinue, OnPause, OnStart and OnStop in case you need more time.

https://docs.microsoft.com/en-us/dotnet/api/system.serviceprocess.servicebase.requestadditionaltime?view=dotnet-plat-ext-5.0

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM