问题
We have an .NET desktop application that crashed in production. How do we diagnose the error? I'd like to know the type of exception that occurred, the error message, and the stack trace.
Because the exception wasn't handled by our code, we received the "This application has encountered a problem and needs to close" Windows message box. The only option was to close, there was no debug button.
This MSDN article suggested looking in the Windows Event registry. I checked there, and here's the information inside it:
Faulting application Initect.Server.UI.exe, version 0.12.9084.90, time stamp 0x49cac472, faulting module KERNEL32.dll, version 6.0.6001.18000, time stamp 0x4791a81d, exception code 0xe0434f4d, fault offset 0x0002f35f, process id 0x44c, application start time 0x01c9ada7f320cab0
How can this information tell me the exception type, the stack trace, and the error message?
回答1:
That information isn't enough to get you a stack trace, exception type, error message, etc.
You can configure Windows Error Reporting (which showed you the problem & needs to close UI) on Windows Server 2008 to always collect a dump file that you can then debug. This doesn't require you to install Visual Studio or any other debugger in your production environment.
http://blogs.technet.com/askperf/archive/2008/02/05/ws2008-windows-error-reporting.aspx shows the proper registry settings to do this.
来源:https://stackoverflow.com/questions/711032/diagnosing-clr-errors-in-windows-event-viewer