HttpWebRequest常用问题!
webrequest.ServicePoint.Expect100Continue = false;
//是否使用 Nagle 不使用 提高效率
webrequest.ServicePoint.UseNagleAlgorithm = false;
//最大连接数
webrequest.ServicePoint.ConnectionLimit = 65500;
//数据是否缓冲 false 提高效率
webrequest.AllowWriteStreamBuffering = false;
代理的使用:
if (proxy!=null)
{
model.proxy = proxy;
WebProxy myProxy = new WebProxy(proxy.ProxyInfo, false);
myProxy.Credentials = new NetworkCredential("", "");
webrequest.Proxy = myProxy;
}
else
{
webrequest.Proxy = GlobalProxySelection.GetEmptyWebProxy();
}