C# HttpClient请求https类型接口地址提示:未能创建 SSL/TLS 安全通道
在HttpClient建立连接前加上:
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
ServicePointManager.ServerCertificateValidationCallback += RemoteCertificateValidate;
private static bool RemoteCertificateValidate(object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors error)
{
return true;
}