Windows service in Task Scheduler - the service cannot be started. Service process could not connect to the service controller

I have a simple windows service project. I followed the instructions located at http://msdn.microsoft.com/en-us/library/zt39148a.aspx , including adding custom actions.

When starting my build in release mode for the installation project. I am running .msi on a server that I would like to run for a service. When I open Service Manager, a service will appear. I can even start the service manually, and it works exactly as I need.

However, I would like this service to start every 5 minutes, so I configured the task in the task scheduler and pointed to the .exe of my Windows service on the task. However, when the task scheduler starts my Windows service, I get the following error:

The service cannot be started. Service process could not connect to the service controller

I have done a lot of research on this, but haven’t come up with anything. Anyone have any ideas on what could be causing this?

+5
source share
2 answers

OK, this will not work. You cannot start your exe service in the same way as from the Task Scheduler. You must use the "Net start" command to start the service.

" " , UAC, Windows Vista .

+2

, , . , .bat, .bat , :

NET START MyServiceName
NET STOP MyServiceName

NET STOP , .

!

+1

All Articles