线程正在中止

时间:2012-08-28 19:23:26

标签: c# asp.net .net sql-server sql-server-2005

这究竟是什么意思如下。我正在运行异步Web请求,该请求调用将代码发送到我的数据库的页面。然后我的数据库触发一个运行到我的SQL程序集之一的存储过程。大多数时候它都有效,但有时我会得到这个:

线程正在中止。

描述:执行当前Web请求期间发生了未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。

异常详细信息:System.Threading.ThreadAbortException:正在中止线程。

来源错误:

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.

堆栈追踪:

[ThreadAbortException: Thread was being aborted.]
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +486
    System.Web.ApplicationStepManager.ResumeSteps(Exception error) +501
    System.Web.HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) +123
    System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +379

2 个答案:

答案 0 :(得分:0)

您最有可能获得此错误的原因是您正在超时。增加ExecutionTimeout,因为默认情况下为110秒。

<compilation debug="false"></compilation>
<httpRuntime executionTimeout="1800"/> //1800 seconds / 30 minutes. 

这里有一个article,详细介绍了如何增加ExecutionTimeout。

答案 1 :(得分:0)

app域可能会被回收,这可能由于多种原因而发生。这可能会导致线程中止异常。

Here is an article which explains some of the reasons for a recycle

如果进程长时间运行,IIS / ASP.Net通常不是运行它的好地方。