Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The service process could not connect to the service controller

Tags:

c#

service

Hi I am trying to write just a quick demo service. I am following the tutorial from MSDN here:

http://msdn.microsoft.com/en-us/library/zt39148a.aspx

So this tutorial basically sets up an basic service that writes to the event log. It also configures the installation and adds a setup project. So I have tried the installation on a couple of computers, one running Server 2008 R2 and one running Windows 7.

Basically what happens is the setup runs fine, but the service does not show up in the service list. I also checked the event log and receive an error with a description of:

"The service process could not connect to the service controller"

However there is no other information about the error. Does anyone have any idea how to get the service to show up in the service list and to run? Thanks.

One other item I could mention is that the custom log for the service is created however there are no entries.

like image 767
Payson Welch Avatar asked Jan 08 '11 17:01

Payson Welch


2 Answers

The message "Service cannot be started. The service process could not connect to the service controller" is logged in the event log everytime you attempt to run a windows service from Visual Studio. Unlike most projects you create in Visual Studio, Windows Service projects cannot be run directly from the development environment by pressing F5. See the following msdn link http://msdn.microsoft.com/en-us/library/sd8zc8ha.aspx

like image 68
CleanCoder Avatar answered Sep 17 '22 18:09

CleanCoder


Problem solved. I didn't follow the last part of the tutorial for adding a custom action :) I thought at first it was optional however it appears that is the final part of installing the service. Works perfect now.

like image 40
Payson Welch Avatar answered Sep 20 '22 18:09

Payson Welch