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?
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";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With