HttpWebRequest issues
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 ma开发者_高级运维king 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;
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 :)
精彩评论