I am support for an application that uses two Windows services to perform two very different tasks. One controls scheduled executions of a app, one runs continuously listening for HL7 messages being transmitted on a particular port. Both of them have a propensity to fail. We have identified that failing connections to database servers, network shares and the like is the likely culprit of the failures and the services most times restart with no issue. The problem is sometimes the services stop working but continue to display a status of 'Running' in Windows service mgr. and if you use command line query of the service. It is only when you then proactively attempt to stop and restart the service that you realize the service is stopped as attempting to stop it from the Service mgr console times out and returns a generic 'Service is not responding in a timely manner.' message. You then have to kill the process thread it is running on to stop it.
I would like to know two things: One: Is there a way of monitoring services that would be able to return more information than just the reported status of the service? Open to third party options.
Two: Is it possible to use the default Windows service recovery options to do a scheduled restart of the service that would function through the time out and error message when attempting to stop the service if it were in the misreporting status state?
Apologies for the wordiness. Trying to balance as much information as useful vs spewing out the hours of putzing about I have spent working on this.