Home > DeveloperSection > Interviews > How to find out if a service present in different machine has been stopped or started.

Posted on    November-09-2011 12:52 AM

 C# C# 
 1 Answer(s)
  1779  View(s)
Rate this:

Awadhendra Tiwari

Total Post:510

Posted on    November-09-2011 1:00 AM

Use ServiceController Class present in System.ServiceProcess namespace to determine the status of the service.
Have a timer in the application which is monitoring the service. The timer should poll service to determine its status.
ServiceController c = new ServiceController("<servicename>", "<machine name>");

Don't want to miss updates? Please click the below button!

Follow MindStick