我仍然在使用HttpWebRequest时遇到问题。
由于某些原因,在我的应用程序中,调用有时会超时……
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();我正在关闭响应,但我只是想知道它是否更有可能失败,因为我到处都是请求?
我尝试尝试使用ServicePointManager类,希望它能有所帮助,但它并没有真正起到作用
System.Net.ServicePointManager.DefaultConnectionLimit = 100;
System.Net.ServicePointManager.MaxServicePoints = 100;发布于 2010-04-09 11:33:10
最好的方法是在超时之后,了解它超时的原因。System.Net跟踪或诸如微软网络监视器和Wireshark之类的工具可以提供帮助。
此外,我同意8%看起来很糟糕,伙计:)
https://stackoverflow.com/questions/2603872
复制相似问题