将我的开发计算机升级到 Windows 10 后,我的 ASP.NET 应用程序已开始在任何时候调用 Response.End 或 Response.Redirect 时发出 ThreadAbortException。
我从研究中了解到这是预期的,您可以调用其他不会引发错误的函数。但是,在升级到 Windows 10 之前,我从来没有处理过这个错误。以前我使用 .NET 4.52 运行 Windows 8.1,而 Windows 10 现在是 .NET 4.6,所以我认为这与它有关。所以问题是为什么它刚刚开始抛出异常,有没有办法让它停止而不转换我的代码。
Thread was being aborted.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Threading.ThreadAbortException: Thread was being aborted.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[ThreadAbortException: Thread was being aborted.]
System.Runtime.InteropServices.GCHandle.InternalFree(IntPtr handle) +0
System.Runtime.InteropServices.GCHandle.Free() +77
System.Web.Util.GCUtil.UnrootObject(IntPtr pointer) +65
System.Web.ApplicationStepManager.ResumeSteps(Exception error) +687
System.Web.HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) +247
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +647
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.79.0