I am using ServiceController to get the list of services and its status.
Below is the sample code:
var scServices = ServiceController.GetServices(machineIPOrName).ToList();
var scservice = scServices.FirstOrDefault(i => i.ServiceName.ToUpper().Equals(serviceName.ToUpper()));
Currently it returns if the service is Running, Stopped, StartPending, StopPending , Paused etc. But sometimes even though the service is Running. It will be in a hung up/ struck state, it will not be doing its job. How do i identify if the service is struck or in hunged state ?