Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error installing Windows service -- The service did not respond to the start or control request in a timely fashion

I have a Windows service application which I have installed on my machine without issue. I went to install it on another machine, and I'm receiving the error

Error 1001. An exception occurred during the Commit phase of the installation. This exception will be ignored and installation will continue. However, the application might not function correctly after installation is complete. Cannot start service MyService on computer ‘.’. The service did not respond to the start or control request in a timely fashion.

This error is popping up immediately without any hanging. Normally I would only expect to see this error after a hang.

I'm using the .NET 4 framework, which is installed on both machines. I've tried disabling the antivirus program thinking that might be interfering with the service startup, but that yielded the same error. The firewall was also disabled.

Is there anything else that could be causing this issue?

like image 803
Poosh Avatar asked Jan 27 '26 10:01

Poosh


1 Answers

This behaviour usually occurs when an exception is thrown in the WinService's OnStart method and is not caught in a try-catch block. I believe you can check out the exception message and stack trace using the EventViewer, if not you can easily implement a simple logging functionality using the EventLog class.

Sometimes the exception is thrown because the service is not running under a privileged account. To fix this you have to configure your installer's ServiceProcessInstaller object like the following:

myServiceInstaller.Account = ServiceAccount.User;
myServiceInstaller.Username = "Domain name\User name";
myServiceInstaller.Password = "qwerty";
like image 86
Thomas C. G. de Vilhena Avatar answered Jan 29 '26 00:01

Thomas C. G. de Vilhena



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!