Problem with HttpWebRequest

  • Thread starter Thread starter Danny
  • Start date Start date
D

Danny

Hi.

I am using HttpWebRequest to implement a Web client that downloads many
URLs. I notice that after running for a while, my apps crashes with an
exception in System.DLL titled "Unable to read data from transport
connection."

Is this a bug in HttpWebRequest? Is there a workaround?

I also noticed the same problem when I tried using WebClient instead of
HttpWebRequest.

Thanks!

-Danny-
 
Hi,

Ensure you Dispose() or Close() (whatever is more appropriate) an
HttpWebRequest instance when it is no more needed.
 
It could be that the connection got closed, by either the client or the
server. In order to find which one, run a packet sniffer and see which side
is tearing down the connection first.

Are you doing multithreaded downloads ?

--
Remove "user" from the email address to reply to the author.

This posting is provided "AS IS" with no warranties, and confers no rights

Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
 
Hi Feroze.

Sorry for the delay in responding to you. Yes, I am doing multithreaded
downloads. I have noticed that even though I am making a sync call to
download the URLs (via HttpWebRequest or WebClient), the component actually
uses the thread pool via an async call and then waits for the call to
complete. This is causing major problems from a scalability standpoint (I am
working on a server).

This design should work fine for clients but for servers, this is a problem.
Is there a workaround for this? Is there another version of HttpWebRequest
out there or is one planned by Microsoft?

Thanks!

-Danny-
 
Also:

Because the [unhandled] exception is thrown on a thread pool thread, there
is nothing I can do from my thread to handle it. This is a major problem.
Please advise on any workarounds.

Thanks!

-Danny-
 
Back
Top