Click here to Skip to main content
15,893,161 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
Services
---------------------------
Windows could not start the Window Service service on Local Computer.



Error 1053: The service did not respond to the start or control request in a timely fashion.


I am trying to compress the pdf. If the pdf size is greater than 30 mb i am getting above error.

What I have tried:

I had Done Following changes in registry

C#
Create the registry entry for the Services Pipe Timeout and give it higher than the default value:
Start the registry editor (regedit.exe)
navigate to the following key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control
Right-click on the above key and choose New, then DWORD Value
Type ServicesPipeTimeout as the name for it and press ENTER
Right-click on the ServicesPipeTimeout value and choose to Modify it
In the Base section click Decimal
In the Value data text box type for example 180000 as the value of timeout period and click OK
Restart the computer


Then also it is giving same error.
Posted
Updated 21-Nov-16 21:57pm
Comments
Richard MacCutchan 22-Nov-16 2:46am    
The error is telling you what the problem is. You need to do some debugging to find out why.
Mehdi Gholam 22-Nov-16 2:47am    
Show your code, the above explanation is not helpful.

Also why compress a pdf in a service on the service startup.

The startup of a Windows Service is just a start of that service including its configuration. It is not at all meant for doing the work the service was created for. That work has to be done after startup.
 
Share this answer
 
Use a timer in your OnStart to perform the action you want so as not to block the OnStart from returning on time.

Don't do your action (compressing etc..) for a few seconds after the OnStart has been called thereby not blocking and causing a timeout.

If you think about it - it's good that it does time out - can you imagine having quite a few services blocking the service manager for extended periods of time?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900