Unable to install service using sc command

心不动则不痛 提交于 2020-01-26 03:33:49

问题


I have my service under this folder path

C:\Users\Documents\Visual Studio 2012\TestServices\TestServices\InboundMessage.ServiceHost\bin\Debug --- > here is were all my dlls and .exe is

I use this command to install to my local box

sc create "Receiver Services" binPath= "C:\Users\Documents\Visual Studio 2012\TestServices\TestServices\InboundMessage.ServiceHost\InboundMessage.ServiceHost.exe" displayname= "*Receiver Services"

sc description "Receiver Services" "Receiver Services."

sc delete "Receiver Services" "Receiver Services."

I opened my cmd(c:\windows\System32) and execute the above command.

the service is installed but i am not able to start it because it throw the error: Windows couldn't start the service on local machine Error 2:the system couldn't find the file specified.

EDIT: I right click and check the property of the service installed to check the path. and it matches the one I put in the command


回答1:


You can use InstallUtil.exe.

Execute the Developer Command Prompt for VS2012 with high privileges and then run:

installutil yourWithAWindowsService.exe




回答2:


there is one spelling error. Now my service is up and running.



来源:https://stackoverflow.com/questions/22416910/unable-to-install-service-using-sc-command

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