Is there a way to set a different value for service startup timeout per service? I can change it using the ServicesPipeTimeout registry key, but it's per machine (http://support.microsoft.com/kb/824344).
At the moment the only thing I thought about was to do all the time-consuming startup actions in a different thread.
When a service starts, it communicates to the Service Control Manager how long it has to start in what's called the service's timeout period. If the Service Control Manager does not receive a "service started" notice from the service within this timeout period, it will terminate the process that hosts the service.
You can get the value by accessing the registry key at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control key ServicesPipeTimeout . If this value is not set, its default value is set to 125 s ( see https://msdn.microsoft.com/en-us/library/windows/desktop/ms685149(v=vs.85).aspx to learn more about it ).
I agree with Romulo on finishing to start your service as soon as possible. However, if you need the time and you are using .NET Framework 2.0 or later, you might consider ServiceBase.RequestAdditionalTime() method.
http://msdn.microsoft.com/en-us/library/system.serviceprocess.servicebase.requestadditionaltime.aspx
protected override void OnStart() { this.RequestAdditionalTime(10000); // do your stuff }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With