zoukankan      html  css  js  c++  java
  • The request was aborted: Could not create SSL/TLS secure channel

    一、背景:

    公司底层服务CDN从Akamai迁移到阿里云之后, 使用该服务的一个应用报错如下:

    System.AggregateException: One or more errors occurred. ---> System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: The request was aborted: Could not create SSL/TLS secure channel.
       at System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult, TransportContext& context)
       at System.Net.Http.HttpClientHandler.GetRequestStreamCallback(IAsyncResult ar)

    二、排查步骤:

      1、使用Postman测试接口没有问题.

      2、本地调试发现HttpClient不能获取返回结果, 两种情况, 一种请求压根没发出去, 第二种是在网络层面被拒绝了.

      3、从报错信息来看, 个人感觉是第二种, 看上去像是网络协议的问题.

    三、解决办法:

    定位了问题就好办了, 网上一查便知, 添加了如下代码:

    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls
            | SecurityProtocolType.Tls11
            | SecurityProtocolType.Tls12
            | SecurityProtocolType.Ssl3;
  • 相关阅读:
    多对多关系表的创建方式、forms组件
    SweetAler弹框插件与分页器插件
    Django数据库查询优化与AJAX
    django orm(2)
    Django orm(1)
    Django之视图层与模板层
    Django之路由层
    初识Django之前端后端与数据库的配置
    面试题49
    web框架之初识Django
  • 原文地址:https://www.cnblogs.com/jerryqi/p/11392913.html
Copyright © 2011-2022 走看看