SEARCH:   GO
{Blog entries}
Feb 23

Written by: Javier Callico
2/23/2007  RssIcon

After looking at the error log of one of the applications I currently maintain I noticed that the "Thread was being aborted" error was happening a lot and decided to investigate a little further.

If you Google this error you will find lots of articles recommending not to have a Response.Redirect inside a try/catch block and since I was also redirecting at the method where the error was happening I was distracted a little bit trying to “fix” the problem by moving the redirect out of the try/catch block or setting the Redirect’s endResponse parameter to false but the error kept happening.

I kept looking for a while and found the real cause of the problem: Since the default value for synchronous calls to XML Webservices in .NET is 100 seconds and the default value for request timeouts is 90 seconds, your page request will timeout before your webservice call does and .Net will try to terminate the thread where the webservice call is being executed.

In order to fix the problem try to avoid the page request timeout by setting a timeout value less than 90 seconds for the webservice call.

The article below describes a problem when invoking in-process COM+ components but the cause is exactly the same: time-out threshold for an ASP.NET request is exceeded:

http://support.microsoft.com/kb/917069

Tags:
Categories:

2 comment(s) so far...


Gravatar

Re: Thread was being aborted error when calling .net webservices

Thanx javier for your solution,really i have googled so many sites for it & found at last this solution.It really works as i minimizes the session time out of my application

By Rahul on   8/6/2010
Gravatar

Re: Thread was being aborted error when calling .net webservices

You're welcome. I'm glad I was able to help.

By Javier Callico on   8/6/2010

Your name:
Gravatar Preview
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Title:
Comment:
Add Comment   Cancel