Reputation: 1
I have created a service that worked before on multiple computers and works while debugging just fine. But for whatever reason, it will not install on any computers that I have tried recently.
Below are the issues I am running into:
Program will not install if I have the "turn on after install" property on. Code is below:
new ServiceController(serviceInstaller1.ServiceName).Start();
Whenever I try to install the service with the above code disabled, it actually installs. But, the service refuses to start when I try to start it up manually. I get the following
"Error 1053: The service did not respond to the start or control request in a timely fashion."
Things I have tried
Before you ask
My question is, why will this program work perfectly while debugging but will not install at all anymore after it just worked perfectly 3 days ago?
Upvotes: 0
Views: 36
Reputation: 137118
Without seeing your code this is just an educated guess but the error is giving you a big clue to the problem:
"Error 1053: The service did not respond to the start or control request in a timely fashion."
This means that your service's start method doesn't return quickly enough for the system. When you debug the service it doesn't actually start as a service so this check never fires. If this was working a while ago then you must have added some extra processing in the start method.
The only solution is to move all the processing out of the start method. The normal way is to start a background worker thread in the start method so that it returns as quickly as possible and do all the processing in the thread instead. Then it can take as long as it needs to complete.
Upvotes: 1