使用HttpWebRequest 一定要保证GetRequestStream和GetResponse对象关闭,否则容易造成连接处于CLOSE_WAIT状态
using (Stream stream = webReq.GetRequestStream()) { stream.Write(buffer, , buffer.Length); } HttpWebResponse response = null; try { response = webReq.GetResponse() as HttpWebResponse; } finally { try { if (response != null) response.Close();
--