使用AppDomain的UnhandledException事件:
static void Main(string[] args)
{
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
}
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
// log the exception
}
Run Code Online (Sandbox Code Playgroud)
对于ASP.NET使用,您将使用glabal.asax.
| 归档时间: |
|
| 查看次数: |
1313 次 |
| 最近记录: |