Re: WebRequest times out...but only 3rd time and on...

Tech-Archive recommends: Fix windows errors by optimizing your registry



Thanks Jon, that was it. As I wasn't putting it into a reponse object I
couldn't see it, but now it works great.
System.Net.WebResponse resp = req.GetResponse();
resp.Close();

"Jon Skeet [C# MVP]" <skeet@xxxxxxxxx> wrote in message
news:1140705186.030954.131170@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Tim Cowan wrote:
I put this code in a windows forms app for testing. The IP values are
both
correct. It works the first time, the second time but at the third time
it
fails with timeout... I have it running here AND in a service with a 30
minute interval.

1. Am I doing this correclty? Is there a better way to go to a URI and
pass
a couple of variables?

I don't have time to look at the rest of your code in detail at the
minute, but I believe the problem is that you're not disposing of the
WebResponse. If you do, you should notice everything being fine. .NET
is happy to have two connections up at a time, but your existing
responses are "hogging" the connections it's made.

Jon



.



Relevant Pages

  • Re: Mailbox replication
    ... Next question then is how heavily utilised are the connections and what is ... the network latency on these connections as latency is the killer for user ... jON ... where their home server is located? ...
    (microsoft.public.exchange.admin)
  • Re: Newsgroups; How can you download more than three posts at a time?
    ... see_signature@xxxxxxxxxxxxxxx (Jon) wrote: ... great speed, no ads. ... No binaries, though. ... I think they limit you to four connections at a time ...
    (comp.sys.mac.system)
  • Re: Internet problems 27/4/2006
    ... Jon B wrote: ... Don't think my connections have been switched to ... Windows free zone ... (Part time web site) ...
    (uk.comp.sys.mac)
  • Re: When do DataReaders close?
    ... You can reach me thru my blog at - ... > Don't Connections and DataReaders close automatically when destroyed? ...
    (microsoft.public.dotnet.framework.adonet)