心酸

记录一下postman 正常返回 c# 模拟https 请求出现The request was aborted: Could not create SSL/TLS secure channel.

电脑版发表于:2023/7/24 14:02

在发送请求前加入如下代码:
//始终验证服务器证书

ServicePointManager.ServerCertificateValidationCallback =
(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) => { return true;};
//设置协议
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3  |
                                      SecurityProtocolType.Tls12 |
                                      SecurityProtocolType.Tls11 |
                                      SecurityProtocolType.Tls;

关于TNBLOG
TNBLOG,技术分享。技术交流:群号677373950
ICP备案 :渝ICP备18016597号-1
App store Android
精彩评论
{{item.replyName}}
{{item.content}}
{{item.time}}
{{subpj.replyName}}
@{{subpj.beReplyName}}{{subpj.content}}
{{subpj.time}}
猜你喜欢