开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜