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();
  }

 

posted on 2013-03-20 02:12  鬼蝶[DFCG]  阅读(391)  评论(0编辑  收藏  举报

导航