Check if a program has thrown an exception
I'm working on a status monitoring program for my company and we need to be able to know if a process on a remote machine is hanging due to not responding (that I can do) or if it's thrown an unhandled exception. I've tried a number of things from checking the CPU usage of the process to checking if the process has gone idle. Nothing has really been reliable. Is there anyway to do this? All the programs we'll be monitoring are running on either .NET 3.5 or 4.0.
The answer will be much easier if you have control over the source of those applications.
The way that we handle this scenario is that the applications to be monitored periodically write their status to a central database. The monitoring application then checks the status in these tables on a regular basis and, if the status isn't updated for a specific period of time (ie 2 minutes), alerts are generated.
This helps us identify not only application problems, but also connectivity problems and unexpected machine reboots.
检查事件日志(系统/安全)是否会帮助您将事件的来源作为您正在监控的过程?
You might try monitoring the event log on the system that the process is running on. When a process throws and exception that is unhanded an entry is made here with the process and some details on the error.
There are a few other questions here on the stack that deal with this same question.
catch another process unhandled exception
How to catch exceptions from processes in C#
上一篇: 在一个二进制文件中定位多个.NET框架?
下一篇: 检查程序是否引发异常