1、基礎(chǔ)連接已經(jīng)關(guān)閉:
處理:request.Abort();
response.Close();
System.GC.Collect();
request.ProtocolVersion = HttpVersion.Version10;
2、操作超時:
處理:System.Net.ServicePointManager.DefaultConnectionLimit = 200;//增加并發(fā)連接數(shù)(有的也不管用)
request.ServicePoint.Expect100Continue = false;(是否在請求服務(wù)器前,詢問是否需要以【100-continue】的形式請求后等待服務(wù)器響應(yīng)
響應(yīng)通過驗證,返回status 100,然而現(xiàn)在是“false” 說明是不需要的詢問服務(wù)器)
3、基礎(chǔ)連接已經(jīng)關(guān)閉: 服務(wù)器關(guān)閉了本應(yīng)保持活動狀態(tài)的連接。
處理:request.KeepAlive = false;
4、HTTPS請求:基礎(chǔ)連接已經(jīng)關(guān)閉: 未能為SSL/TLS 安全通道建立信任關(guān)系
private static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
{
return true;
}
ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);
ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;//TLS1.2
posted on
浙公網(wǎng)安備 33010602011771號