I’m having a problem with a service not automatically starting on restart right after installation.
I’m creating the service by executing:
sc create MyService binPath= "C:\path to service\MyService.exe" start= auto
After reboot, the service did not start automatically.
However, if I execute:
sc create MyService binPath= "C:\path to service\MyService.exe" start= auto
net start MyService
net stop MyService
and reboot… the service starts… (Same result if don’t execute net stop MyService
Why net start ... have to be called at least once after sc create for the service to start automatically?
The service have to start AFTER next restart so calling net start is not an option for me.
I had a similar issue, but just used the ServiceController class to auto start after installation was completed. My service was only failing to start directly after installation (again with no errors), but after a user logged on or rebooted the service was up and running without issue.