Run an executable as service in C++

时光怂恿深爱的人放手 提交于 2019-12-13 04:47:12

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!