C#request 请求tls1.2 出现异常解决方式

系统win10 及以下:

1. 先用IISCrypto.exe 开启 tls1.2 1.3 之类。

2. 代码中使用  

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12| SecurityProtocolType.Tls13;
// 跳过https 证书校验
ServicePointManager.ServerCertificateValidationCallback = (sender1, certificate, chain, errors) => true;

3. net 4.6以上 使用 (类似)

 HttpClientHandler handler = new HttpClientHandler();
                handler.SslProtocols =System.Security.Authentication.SslProtocols.Tls12 | System.Security.Authentication.SslProtocols.Tls11;
                handler.ServerCertificateCustomValidationCallback = CheckSSL;
                HttpClient client = new HttpClient(handler);

4. 上述都做了还出现如下类似的错误

请求的安全协议不受支持

5.那么就不要在做无用功了,下列方法解决

5.1 重装高版本系统(服务器和客户端都安装高版本)

5.2 重写 request 内部进行识别 ssl 然后进行跳过 校验

  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值