ASP.NET 2.0 网站出现 ThreadAbortException

发布于 2024-08-02 18:03:55 字数 378 浏览 2 评论 0原文

我们正在将 Web 服务作为网站项目运行。客户端发出的请求会在几秒钟后返回,但会生成一个应该运行几个小时的线程。该线程发出 Web 请求并向数据库写入数据,并通过 Thread.Sleep 调用进行限制。

在多个线程运行大约 20 分钟后,所有线程同时收到 ThreadAbortException。 Thread.resetAbort 没有帮助。该异常可能发生在 SQL 调用期间、Web 请求期间或 Thread.Sleep 期间。

我认为问题可能出在 web.config 中的 httpRuntime 属性 executionTimeout 上,但这并没有解决问题。

还有其他想法可能会杀死我们所有的线程吗?

We're running a web service as a web site project. Clients make requests which return after a few seconds, but which spawn a thread that should run for hours. The thread makes web requests and writes to a database, and is throttled with Thread.Sleep calls.

After running for about 20 minutes with several threads running, all the threads receive a ThreadAbortException at the same time. Thread.resetAbort doesn't help. The exception can occur during a SQL call, during a web request or during a Thread.Sleep.

I thought the problem might be the httpRuntime attribute executionTimeout in web.config, but that didn't solve the issue.

Any other ideas what might be killing off all our threads?

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

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

发布评论

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

评论(2

紫轩蝶泪 2024-08-09 18:03:55

我猜想 Web 应用程序拥有该线程,并且应用程序在一段时间后关闭。

如果我正在设计这样的东西,我会编写一个Web服务,它接受你的客户端请求并将它们放入数据库中,然后我会编写一个Windows服务,轮询该数据库以获取客户端请求并生成执行任何操作的线程是您需要的(发出网络请求并写入数据库)。听起来您正在编写某种处理器引擎,而且我认为 ASP.NET 应用程序不是托管此类事物的好地方。

I would guess that the web application owns the thread, and the application shuts down after a period of time.

If I were architecting something like this, I would write a web services which takes yourp your clients requests and puts them in a database, then I'd write a windows service that polls that database for client requests and spawns the threads which do whatever it is you need (makes web requests and write to a database). It sounds like your writing some sort of processor engine, and I don't think an asp.net app is a good place to host that kind of thing.

流绪微梦 2024-08-09 18:03:55

IIS 中的应用程序池有空闲超时。它需要被关闭。

(管理工具 > IIS。右键单击应用程序池 > 属性。性能选项卡。)

The application pool in IIS has an idle time-out. It needed to be turned off.

(Administrative Tools > IIS. Right-click the application pool > properties. Performance tab.)

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