【问题标题】:HttpWebRequest issuesHttpWebRequest 问题
【发布时间】:2010-04-08 22:27:05
【问题描述】:

我在使用 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;

【问题讨论】:

  • 请关闭更多问题。 8% 太低,不值得回答。

标签: c# httpwebrequest timeout


【解决方案1】:

最好的方法是在超时之后去了解它超时的原因。 System.Net 跟踪或 Microsoft Network Monitor 和 Wireshark 等工具可以提供帮助。

另外,我同意 8% 看起来很糟糕,伙计 :)

【讨论】:

  • 对不起,我是新来的,没有意识到人们关心他们的答案被关闭...现在会努力这样做......
猜你喜欢
  • 1970-01-01
  • 2012-02-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-03-14
相关资源
最近更新 更多