问题
I created a Win32Console application using MSVS2013 and it was compiled successfully. Now I tried creating a service using CreateService and binary path was set to the path of the above produced executable. Though I was able to create the service, I cannot start it using StartService. The error code 1053 is thrown each time. I tried using sc.exe and also tried to start the service manually from Services. The same error is shown. How can I solve it now?
回答1:
You must create a ServiceMain.
Here is a sample.
If you want to execute a non-service application you can use psexec.
来源:https://stackoverflow.com/questions/30596478/run-an-executable-as-service-in-c