且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在后台线程ASP.NET异常处理

更新时间:2023-02-16 12:47:20

您需要捕捉回调内部的异常(如在你的例子),以避免传播到调用线程。这是推荐的模式。如果它是一个ASP.NET应用程序,你也可以处理它在的Application_Error 方法的Global.asax

You need to catch the exception inside the callback (as in your example) to avoid propagating into the calling thread. This is the recommended pattern. If it is an ASP.NET application you could also handle it in the Application_Error method in Global.asax