Arbitrary raised WebException: The underlying connection was closed: The request was canceled

  • Thread starter Alexander Oldemeier
  • Start date
A

Alexander Oldemeier

Hello there,
I am using serveral HttpWebRequest classes at the same time to download the
content of web pages from one single web server in a multithreaded
application (c#, framework 1.1). Now I somtimes get the exception ". The
underlying connection was closed: The request was canceled". The exception
is raised before the timeout of GetResponse (I am using the synchronous
GetResponse) has elapsed. There is no inner exception and no further
information. The occurence is totally random, but the more parallel
downloads I run the more exceptions I get. I am not exceeding the default
thread pool. When I access the web resource via Internet Explorer while the
application downloads from the same server no problems occur (the problems
occur further in the application and I get the content arbitrary but IE
downloads it without problems). So I infer there's nothing wrong with the
connection or the network but something wrong in my application. Are there
any ressources about this error? Has anybody a hint? I don't know where to
look anymore.
Thanks for your help
Alex
 
M

Mark Hurd

We're having a similar problem with .NET 2.0 and a multithreaded VB.NET
application using WebClient.UploadValuesAsync, except it is more
repeatable -- the connection is mostly "canceled" and occasionally works,
working more often when there's a few attempts happening at the same time.

(A previous build that calls WebClient.UploadValuesAsync from the main (COM)
thread works most of the time. And it doesn't happen on the Windows XP Pro
SP2 development machine, with the .Net 2.0 SDK, only on two WinXP Pro SP2
production machines, with the .Net 2.0 Framework redistributable.)

It sounds like a race condition, but where...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top