zoukankan      html  css  js  c++  java
  • 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;

    再次发送问题解决!

  • 相关阅读:
    Python学习4
    Python学习3
    Python学习2
    表空间
    sqlplus常用设置
    HashMap和LinkedHashMap
    堆栈源码
    观察者模式
    策略模式
    java线性表
  • 原文地址:https://www.cnblogs.com/paul010/p/11888498.html
Copyright © 2011-2022 走看看