1、基础连接已经关闭:
处理:request.Abort();
response.Close();
System.GC.Collect();
request.ProtocolVersion = HttpVersion.Version10;
2、操作超时:
处理:System.Net.ServicePointManager.DefaultConnectionLimit = 200;//增加并发连接数(有的也不管用)
request.ServicePoint.Expect100Continue = false;(是否在请求服务器前,询问是否需要以【100-continue】的形式请求后等待服务器响应
响应通过验证,返回status 100,然而现在是“false” 说明是不需要的询问服务器)
3、基础连接已经关闭: 服务器关闭了本应保持活动状态的连接。
处理:request.KeepAlive = false;
4、HTTPS请求:基础连接已经关闭: 未能为SSL/TLS 安全通道建立信任关系
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
标签:false,c#,request,ServicePointManager,关闭,服务器,连接 From: https://www.cnblogs.com/yang1/p/17339713.html