Hi,
I'm programming a monitoring application that needs to display the state of several windows services. In the current version, I can know whether a service is Running, Stopped, Suspended or in one of the pending states. That's good, but I'm wondering if there is a way to test if a service is actually responding? I guess it can be in a running state but not responding at all!
I am using the ServiceController
class from System.ServiceProcess
. Do you think that if a service is not responding, the ServiceController.Status
would return an exception?
How would you approach the problem?
Thanks
EDIT
Seems that: ServiceController.Status
can return 2 types of exceptions:
System.ComponentModel.Win32Exception: An error occurred when accessing a system API.
System.InvalidOperationException: The service does not exist as an installed service.
Nothing about reactivity.