How to check application is halt or working from a window service
I have one WPF application and one windows service as watch dog.
I want to check if my window application is halt or working fine. If it is halt i want to restart the application.
I see Process.responding property but it is not working in my service.
Any idea or other solution.
Process[] myProcesses;
myProcesses = Process.GetProcessesByName(ApplicationName);
if (myP开发者_运维技巧rocesses.Length > 0)
{
foreach (Process proc in myProcesses)
{
_Logger.LogMessage("Check responding");
if (!proc.Responding)
In general you cannot detect if a program has halted (lookup "The Halting Problem").
If you have a specific technical definition of "halt" for your case then it might be possible, but the details are everything.
Consider a GUI then is waiting for a network request, so stops processing input... but when the request completes it will start responding. In this case it has halted by one definition, but not in other senses.
精彩评论