今天用httpClient进行获取https内容出错如下:HttpClient 未能创建 SSL/TLS 安全通道.

应该是证书的问题.添加如下代码即可.

  ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
  ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls; 
赞(0) 踩(0)
发表我的评论

最新评论

  1. 暂无评论