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

Time:10-27

I am currently doing this below which sets the Services Pipe value as a DWord file in the registry however I am looking to only increase the timeout for a single service through the registry.

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

CodePudding user response:

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

  • Related