简体   繁体   English

线程中止异常

[英]Thread abort exception

I am having an issue in webservice which resides in mono. 我在webservice中存在一个问题,它存在于mono中。 I am having a webservice which process huge database operation. 我有一个处理大量数据库操作的web服务。 I have given "Timeout = 1024" in the "webconfig" file under "appSettings" tag. 我在“appSettings”标签下的“webconfig”文件中给出了“Timeout = 1024”。

When call is done to the webservice after 2 minuter i am getting "thread abort exception". 在2 minuter之后调用webservice时,我得到“线程中止异常”。

please help me to overcome this problem 请帮我克服这个问题

regards Kumaran 关于库马兰

You want to set the request timeout also. 您还想设置请求超时。 This is something like 30 or 60 seconds by default. 默认情况下,这类似于30或60秒。

In the system.web section, set something like: system.web部分中,设置如下内容:

<httpRuntime executionTimeout="200"/>

This will affect all the pages, so perhaps you want to put the page in a separate folder so that you can have a local web.config file for this setting. 这将影响所有页面,因此您可能希望将页面放在单独的文件夹中,以便您可以拥有此设置的本地web.config文件。

It is bad practice to place long operations (in your case it is over 2 mins) to synchronous web service method. 将长操作(在您的情况下超过2分钟)放置到同步Web服务方法是不好的做法。 Usually web service is only facade to start long time method on back-end server or at least another thread. 通常,Web服务只是在后端服务器或至少另一个线程上启动长时间方法的外观。 Client can periodcally check if operation is done (so called watchdog pattern). 客户端可以定期检查操作是否完成(所谓的看门狗模式)。 Or review possibility to use oneway method - when client doesn't care about result at all. 或者回顾使用单向方法的可能性 - 当客户根本不关心结果时。

By the way, NOTE, even succeed operation in web request must finish with ThreadAbort exception - since HttpRequest contains it raising at end of request processing 顺便说一句,注意,即使在Web请求中成功操作也必须完成ThreadAbort异常 - 因为HttpRequest包含它在请求处理结束时提升

Check the innerexception. 检查不足之处。 That's supposed to have some sort of HttpApplication.CancelModelException that should contain a flag indicating if it's a timeout or not. 那应该有某种HttpApplication.CancelModelException ,它应该包含一个标志,指示它是否超时。 Either way, if you do have an innerexception it may provide more insight. 无论哪种方式,如果你确实有一个不确定的感觉,它可能提供更多的洞察力。

Additionally, make sure your method is set to async . 此外,请确保您的方法设置为异步

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM