线程被中止错误

发布于 2024-07-19 04:30:54 字数 1250 浏览 4 评论 0原文

我们有一个可以创建电子书的应用程序。 该应用程序有一个导出模块,可以创建 AIR 文件,但这可能需要一段时间(有些书有 2500 页)。 如果我们导出,我们会收到以下错误:

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.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +501
   System.Web.ApplicationStepManager.ResumeSteps(Exception error) +564
   System.Web.HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) +141
   System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +436

我已将运行时执行超时更改为 3600 秒,但它在大约 3 分钟内不断崩溃。 所以它与时间有关......每次我们接近 3 分钟时它就会崩溃,我希望有人可以帮助我。

We have an application that can create e-books.
This application has an export module that creates an AIR file but this can take a while (some books have 2500 pages).
If we export we get the following error:

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.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +501
   System.Web.ApplicationStepManager.ResumeSteps(Exception error) +564
   System.Web.HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) +141
   System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +436

I've changed my runtime executiontimeout to 3600 secs but it keeps crashing arround 3 minutes.
so it is time related ... everytime we approach the 3 minutes it crashes, I hope someone can help me out.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

甜扑 2024-07-26 04:30:54

我认为保罗关于异常原因的说法是正确的。 IIS 和 ASP.NET 都有限制请求可以花费的最长时间的设置。 对于 ASP.NET,它位于 Machine.Config 文件中(查找 httpRuntime 元素、executionTimeout 属性)。 在我的开发机器上设置为 90 秒。

不过,我不建议您更改该设置,因为它是为了确保您的应用程序不会因错误请求而挂起。

长时间运行的任务应该使用异步执行。 通过异步执行,实际工作是在单独的线程上处理的。 这可以释放处理请求的线程来处理其他请求,这有利于应用程序的整体性能。

有一些关于这方面的好文章。 例如: http://msdn.microsoft.com/en-us/magazine /cc163725.aspx

I think Paul is right about the cause of the exception. Both IIS and ASP.NET have settings that limit the maximum amount of time a request can take. For ASP.NET it's in the Machine.Config file (look for the httpRuntime element, executionTimeout attribute). It's set to 90 seconds on my development machine.

I would however not advise you to change that setting as it's there to make sure your application doesn't hang on a bad request.

Long running tasks should use asynchronous execution. With async execution, the actual work is handled on a separate thread. This frees the thread that handles the request to handle other requests which is good for the overall performance of your application.

There are some good articles on this available. For example : http://msdn.microsoft.com/en-us/magazine/cc163725.aspx

烂人 2024-07-26 04:30:54

通常,此错误实际上是由 OutOfMemory 异常引起的。
有可用的 InnerException 吗?

Quite often, this error actually occurs from an OutOfMemory exception.
Is there an InnerException available?

﹎☆浅夏丿初晴 2024-07-26 04:30:54

IIS 具有“失控”线程保护功能,如果线程/应用程序域运行时间过长,则会终止该线程/应用程序域。

IIS has a 'run-away' thread protection that will kill a thread/appdomain if it runs for too long.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文