https request报错 ServicePointManager.SecurityProtocol 搞定
Posted paul010
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了https request报错 ServicePointManager.SecurityProtocol 搞定相关的知识,希望对你有一定的参考价值。
突然被同事反馈无法正常发送对应信息,赶紧差错!
发现request请求API接口均报 请求被中止: 未能创建 SSL/TLS 安全通道 非常奇怪,
于是查询环境Framework版本4.0 升级至4.8 故障依旧
查询代码发现需要设置一下ServicePointManager.SecurityProtocol这个类下面的几个枚举属性如下
public enum SecurityProtocolType
{
Ssl3 = 48,
Tls = 192,
Tls11 = 768,
Tls12 = 3072,
}
于是设置 ServicePointManager.SecurityProtocol = (SecurityProtocolType)192 | (SecurityProtocolType)768 | (SecurityProtocolType)3072;
再次发送问题解决!
以上是关于https request报错 ServicePointManager.SecurityProtocol 搞定的主要内容,如果未能解决你的问题,请参考以下文章
https request报错 ServicePointManager.SecurityProtocol 搞定
https网站访问第三方https网站时候报错: The request was aborted:Could not create SSL/TLS secure channel.
Presto Query 通过 ELB 报错“The plain HTTP request was sent to HTTPS”
已解决Https请求报错:unable to find valid certification path to requested target
已解决Https请求报错:unable to find valid certification path to requested target
已解决Https请求报错:unable to find valid certification path to requested target