views:

62

answers:

1

Hi,

Im still having issues using HttpWebRequest.

For some reason sometimes in my app the call just times out...

HttpWebRequest req = null;
req =
   (HttpWebRequest)WebRequest.CreateDefault(new Uri(aRequest));
req.PreAuthenticate = true;
req.AllowAutoRedirect = true;
req.KeepAlive = false;

.....

resp = (HttpWebResponse)req.GetResponse();
resp.close();

I am closing the response but Im just wondering if it is more likely to fail since Im making requests all over the place?

I tried playing around with the ServicePointManager class hoping it would help but it hasnt really

System.Net.ServicePointManager.DefaultConnectionLimit = 100;
System.Net.ServicePointManager.MaxServicePoints = 100;
A: 

The best approach is to go after the timeout and understand why it timed out. System.Net tracing or tools such as Microsoft Network Monitor and Wireshark can help.

Besides, I agree 8% looks bad, mate :)

Lex Li
Sorry Im new here did not realise people cared about having their answers closed...Will now endeavour to do so....
Allen Ho