1. Service Startup
http://msdn.microsoft.com/en-us/library/ms685990(VS.85).aspx
2. A way to prolong start time limit of Windows services in Service Control Manager
When a service fails to send a 'service started' message to the Service Control Manager within the time-out period, the Service Control Manager terminates the service and logs Event ID 7000 to the System event log.
NOTE: The default timeout period is normally 30,000 milliseconds.
I have scripted SvcTimeOut.bat to alter the time that the Service Control Manager wait for each starting service.
The syntax for using SvcTimeOut.bat is:
call SvcTimeOut TimeOutMilliseconds
Where TimeOutMilliseconds is the number of milliseconds that the Service Control Manager should wait.
NOTE:
You must shutdown and restart your computer for the new setting to become effective.
NOTE:
SvcTimeOut.bat uses REG.EXE, built into Windows XP, Windows Server 2003, and later, or installed from the Windows 2000 Support Tools.
SvcTimeOut.bat contains:
@echo off
if {%1}=={} @echo Syntax: SvcTimeOut TimeOutMilliseconds&goto :EOF
@echo REG ADD "HKLM/SYSTEM/CurrentControlSet/Control" /V ServicesPipeTimeout /T REG_DWORD /F /D %1
REG ADD "HKLM/SYSTEM/CurrentControlSet/Control" /V ServicesPipeTimeout /T REG_DWORD /F /D %1
3. How to deal with time consumering start up service ?
A common practice with Windows Services is to create an initialization thread in the "OnStart" method of the service. The thread can do the time consuming start up work. This way, you are guaranteed to have your service start up instantly, and not hit the default 30 second time limit. If for whatever reason something goes wrong with the initialization thread, you can always shut the service down, log errors to the event log, etc.