在要求输入邮箱的文本域,请填写真实的邮件地址。非真实邮件地址,将收不到回复信息。

C#访问https “未能创建 SSL/TLS 安全通道”异常

C# 清风 1587℃ 0评论
C#访问https

C#使用HttpClient访问https请求被中止: 未能创建 SSL/TLS 安全通道(Could not create SSL/TLS secure channel)。
添加回调:
ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(CheckValidationCallback);
还不行, 添加: ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;

private bool CheckValidationCallback(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) 
{
            return true;
 }



转载请注明:清风亦平凡 » C#访问https “未能创建 SSL/TLS 安全通道”异常

喜欢 (25)or分享 (0)
支付宝扫码打赏 支付宝扫码打赏 微信打赏 微信打赏
头像
发表我的评论
取消评论

CAPTCHA Image
Reload Image
表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址