当调用ASP.NET System.Web.HttpResponse.End()时,当前线程中止?

前端之家收集整理的这篇文章主要介绍了当调用ASP.NET System.Web.HttpResponse.End()时,当前线程中止?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
当System.Web.HttpResponse.End()被称为System.Thread.Abort被触发时,我猜测是(或者触发)一个异常?我有一些日志记录,这被列在日志文件中…

第一次机会

exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll
12/14/2008 01:09:31::
Error in Path :/authenticate
Raw Url :/authenticate
Message :Thread was being aborted.
Source :mscorlib
Stack Trace :   at System.Threading.Thread.AbortInternal()
   at System.Threading.Thread.Abort(Object stateInfo)
   at System.Web.HttpResponse.End()
   at DotNetOpenId.Response.Send()
   at DotNetOpenId.RelyingParty.AuthenticationRequest.RedirectToProvider()
   at MyProject.Services.Authentication.OpenIdAuthenticationService.GetOpenIdPersonaDetails(Uri serviceUri) in C:\Users\Pure Krome\Documents\Visual Studio 2008\Projects\MyProject\Projects\Services\Authentication\OpenIdAuthenticationService.cs:line 108
   at MyProject.Mvc.Controllers.AuthenticationController.Authenticate() in C:\Users\Pure Krome\Documents\Visual Studio 2008\Projects\MyProject\Projects\MVC Application\Controllers\AuthenticationController.cs:line 69
TargetSite :Void AbortInternal()
A first chance exception of type 'System.Threading.ThreadAbortException' occurred in Ackbar.Mvc.DLL
An exception of type 'System.Threading.ThreadAbortException' occurred in Ackbar.Mvc.DLL but was not handled in user code

这是正常的行为,是否可以优雅地中止,而不是(什么样子)突然中止?

更新

到目前为止,它是by design的普通人口普查。所以我想知道是否可能我们可以采取这个问题,看看我们是否可以调整代码,使它不觉得我们过早地结束线程,并优雅地退出…可能?代码示例?

解决方法

是的,这是设计的。微软甚至还有 documented。你还能如何停止执行程序的其余部分?
原文链接:https://www.f2er.com/aspnet/252855.html

猜你在找的asp.Net相关文章