我已经尝试了所有设置,我在互联网上找到了让 C# webclient 在 Windows7 机器上快速运行但无济于事。Windows XP 机器上的相同 exe 对每个请求的响应时间少于 100 毫秒。
我已经覆盖了System.Web.Services.Protocols.SoapHttpClientProtocol派生类中的 GetWebRequest 函数
protected override WebRequest GetWebRequest(Uri address)
{
//ServicePointManager.UseNagleAlgorithm = false;
HttpWebRequest.DefaultWebProxy = null;
ServicePointManager.DefaultConnectionLimit = 4096;
ServicePointManager.Expect100Continue = false;
System.Net.ServicePointManager.CheckCertificateRevocationList = false;
HttpWebRequest request = (HttpWebRequest)base.GetWebRequest(address);
request.Proxy = HttpWebRequest.DefaultWebProxy;
return (WebRequest)request;
}
受保护的覆盖 WebResponse GetWebResponse(WebRequest request) {
HttpWebResponse response = null;
//HttpWebRequest.DefaultWebProxy = null;
//ServicePointManager.Expect100Continue = false;
response = (HttpWebResponse)base.GetWebResponse(request);
return response;
}
我还在 machine.config .Net4.0 文件夹中添加了套接字跟踪设置,它总是在输出窗口中等待下面的语句 7-15 秒
System.Net.Sockets 详细:0:[6088] Socket#54042743::Receive()
希望一些冠军已经解决了这个问题