如何知道进程已崩溃 [英] How to know that Process has crashed
问题描述
在我的控制台应用程序我有代码看起来像
In my console application I have code which looks like
Process DKU = new Process();
DKU.StartInfo.FileName = "MSSQLExecutor.exe";
DKU.Start();
DKU.WaitForExit();
Console.WriteLine("lets move on ");
这是工作的罚款,并等待,直到MSSQLExecutor.exe是$ B $后完成其工作,然后b中的应用仍在继续。
This is working fine and it waits until MSSQLExecutor.exe finishes its job, then after that the app continues.
我的问题是,有时MSSQLExecutor.exe崩溃和Windows默认显示结束程序的对话框。在这一点上我的应用程序将永远等待用户点击关闭按钮。
My problem is that sometimes MSSQLExecutor.exe crashes and Windows by default shows a dialog for ending the program. At that point my application will wait forever for the user to click the Close button.
我想避免这种情况,因为我的应用程序将作为无需用户交互服务运行。
I want to avoid this because MY application is going to run as a service without user interaction.
< IMG SRC =http://i.stack.imgur.com/khkHw.jpgALT =后,这是我想对我的丝毫移动应用程序>
推荐答案
对话框阻止该进程存在。
The Dialog prevents that the process exists.
-
如果<$ C> $ C> MSSQLExecutor 是您的应用程序,你应该解决这个问题。
但是你能达到目标(隐藏对话框)。办理Application.ThreadException
和AppDomain.CurrentDomain.UnhandledException
If
MSSQLExecutor
is your Application you should fix the problem. But you can reach the goal (hiding the Dialog). HandleApplication.ThreadException
andAppDomain.CurrentDomain.UnhandledException
Application.ThreadException +=new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
// log the exception
}
static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
{
// log the exception
}
如果 MSSQLExecutor
是不是你的应用程序您可以停用华生医生
If MSSQLExecutor
is not your Application you can deactivate Dr. Watson
博士。沃森是包含在Microsoft Windows操作系统的应用程序的调试器。
Dr. Watson is an application debugger included with the Microsoft Windows operating system.
- 单击开始,单击运行,键入REGEDIT.EXE在打开框中,然后单击确定
- 找到并单击下面的注册表项:结果
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\AeDebug - 单击AeDebug项,然后单击注册表菜单上导出注册表文件。
- 删除AeDebug项。
- Click Start, click Run, type regedit.exe in the Open box, and then click OK.
- Locate and then click the following registry key:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\AeDebug - Click the AeDebug key, and then click Export Registry File on the Registry menu.
- Delete the AeDebug key.
- How to disable or enable Dr. Watson for Windows
More Infromation
这篇关于如何知道进程已崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!