i have a windows service and i want to know when it is not working not every xx minutes or so but when it stopped
i have this method
public string ServiceStatus()
{
switch (_service.Status)
{
case ServiceControllerStatus.Running:
return "Running";
case ServiceControllerStatus.Stopped:
return "Stopped";
case ServiceControllerStatus.Paused:
return "Paused";
case ServiceControllerStatus.StopPending:
return "Stopping";
case ServiceControllerStatus.StartPending:
return "Starting";
default:
return "Status Changing";
}
}
sorry for my bad English
Capture the Stop, etc. events. For example, to know when you are being “stopped”:
Check out ServiceBase for more information.