Posts

Showing posts from January, 2014

The Service on local computer started and then stopped.

Image
Recently i have created a Windows service, then i have installed on my  win7  machine. Whenever i tried to start the service I got the error: “ The Service on local computer started and then stopped ,Some services stop automatically if there are not in use by other services or programs .” This is generally the result of one of three things - either  (a) your  OnStart()  method is throwing an exception  (b) the  OnStart()  method is not kicking off a thread to do work. (c)  assign a  Local System account instead of Local Service account to run this service. If the problem is (a), then the obvious solution is to debug the service to identify what is going wrong. At a minimum, put a  try-catch  block around the contents of the  OnStart()  method and log an error to the system event log when an exception occurs. Then you can see the details in the Windows Event Viewer. protected override void OnStart(string[] args) {         try         {               /