Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

windows service startup timeout

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.

like image 889
Meidan Alon Avatar asked Oct 19 '08 13:10

Meidan Alon


People also ask

What is timeout for a service?

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.

What is default ServicesPipeTimeout?

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 ).


1 Answers

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 } 
like image 98
Hinek Avatar answered Sep 18 '22 17:09

Hinek