您好,欢迎来到尚车旅游网。
搜索
您的当前位置:首页.NetCore访问https接口报错:Therequestedsecurityproto。。。

.NetCore访问https接口报错:Therequestedsecurityproto。。。

来源:尚车旅游网
.NetCore访问https接⼝报错:Therequestedsecurityproto。。

需要在设置协议类型前需要先设置协议版本信息,如下:

HttpWebRequestreq = (HttpWebRequest)HttpWebRequest.Create(url);

ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);//设置协议类型前设置协议版本

req.ProtocolVersion = HttpVersion.Version11;//这⾥设置了协议类型。

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;ServicePointManager.CheckCertificateRevocationList = true;ServicePointManager.DefaultConnectionLimit = 1000;ServicePointManager.Expect100Continue = false;

public bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors){

return true;}

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- sceh.cn 版权所有 湘ICP备2023017654号-4

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务