Click here to Skip to main content
15,895,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, I am very new to creating Windows services and I am encountering one issue. Every time I start my service, nothing happens. So when I check my event log, I only get this message "Service cannot be started. The service process could not connect to the service controller". Any help would be appreciated. Thanks.
Posted
Comments
[no name] 6-Oct-14 12:39pm    
You will get the error if you try and run your program from visual studio. Services need to be installed so the service manager can find them.
[no name] 6-Oct-14 12:50pm    
I did install it on the service manager, I started the service and then when nothing happened I checked the event viewer and saw that message...
Sergey Alexandrovich Kryukov 6-Oct-14 13:14pm    
Not enough information, I would say. I would start with the simplest possible service before adding any useful functionality, just to make sure your workflow works. It's still not too late to do.
—SA
ZurdoDev 6-Oct-14 13:43pm    
You'll have to add some logging to your application.

1 solution

Hi,

try this to debug error.
in Program.cs; Main() function add this code
project solution configuartion set to "DEBUG" mode.
// //****** FOR DEBUG SERVICE
#if(!DEBUG)
ServiceBase[] ServicesToRun;
ServicesToRun = new ServiceBase[]
{
new RService() // your service operation class instance
};
ServiceBase.Run(ServicesToRun);
#else
RService myServ = new RService();// your service operation class instance
myServ.CheckProcessRunning();// your service operation
#endif
//// ****** FOR DEBUG SERVICE

Regards,

Jatinath Jadhav
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900