问题
We got a .NET WCF service that should be 100% uptime ideally. But sometimes we have a memory leaking issues in our application that caused by 3rd party DB connectivity component. We configured nnCron to watch for process existence and when the process of that service is exited, it should start it again.
But when the app is crashing down windows pops up an noisy window informing that app has crashed.
Here it is:
And only when we click on dumb "Close the program" button, the process really disappearing from system. And only after that nnCron restart service. We don't want to monitor this window appearing, just want to get rid of it for nnCron success work.
So how can we disable such windows?
The OS is Windows server 2008 r2 Standard.
回答1:
I know this is an old question, but I was having the same problem and found a solution.
Call the following at the start of your application:
SetErrorMode( SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX );
I've tried it with a very simple test application that attempts to dereference a null pointer. Without the line above, my test application would show "... has stopped working dialog." With the line above, the application just dies quietly.
References:
- Dialog Filter Windows Embedded Standard 7
- MSDN: SetErrorMode function
- pinvoke.net: SetErrorMode
EDIT: Here's an option for disabling that dialog system-wide without modifying code. Create the following registry value as a REG_DWORD and set the value to 1:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\DontShowUI
Reference: WER Settings
来源:https://stackoverflow.com/questions/14451755/disable-application-has-stopped-working-window