一、背景:

公司底层服务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;

The request was aborted: Could not create SSL/TLS secure channel的更多相关文章

  1. 偶尔遇到的“The request was aborted:Could not create SSL/TLS secure channel.”怎么解决?

    项目中涉及到调用第三方的Https的WebService,我使用的是原始的HttpWebRequest. 代码中已经考虑到是Https,加上了SSL3协议,加上了委托调用.但偶尔还是会碰到 The r ...

  2. 微信退款时候报”请求被中止: 未能创建 SSL/TLS 安全通道“或”The request was aborted: Could not create SSL/TLS secure channel“的错误

    如题,英文中文表述的是一个意思 退款测试在我本机测试一切都是正常的,但是发布到了服务器就报这样的一个错啦 但是无论百度或者google或者bing,你能够搜索到的结果都很类似,综合起来就是加这样一些代 ...

  3. 【转】微信退款时候报”请求被中止: 未能创建 SSL/TLS 安全通道“或”The request was aborted: Could not create SSL/TLS secure channel“的错误

    退款测试在我本机测试一切都是正常的,但是发布到了服务器就报这样的一个错啦 但是无论百度或者google或者bing,你能够搜索到的结果都很类似,综合起来就是加这样一些代码,如下 ServicePoin ...

  4. [HTTPS] - 请求API失败(Could not create SSL/TLS secure channel)之解决

    背景 在单元测试中请求 HTTPS API 失败. 异常 Result StackTrace:  at System.Web.Services.Protocols.WebClientProtocol. ...

  5. 请求被中止: 未能创建 SSL/TLS 安全通道,以及解决方法,即:Could not create SSL/TLS secure channel

    C# 访问https请求被中止: 未能创建 SSL/TLS 安全通道(Could not create SSL/TLS secure channel) 以及 X509Certificate2 temp ...

  6. Could not create SSL/TLS secure channel.

    解决办法: ServicePointManager.Expect100Continue = true;ServicePointManager.SecurityProtocol = SecurityPr ...

  7. visual studio Web发布至 IIS WebDeploy出错(未能创建SSL/TLS安全通道)Could not create SSL/TLS secure channel

    问题发生的原因是VS 15.9尝试使用系统默认值进行TLS握手,但是要在VS内的某处设置为TLS1.2. 此问题的解决方法是在部署项目的IIS服务器上启用TLS 1.2.例如,请按照此文章中的说明操作

  8. Could not establish trust relationship for the SSL/TLS secure channel 问题解决方法

    最近在写一个跟第三方对接的数据同步服务,在本地都没有问题,今天放到生产环境测试报错: System.Net.WebException: The underlying connection was cl ...

  9. EX:The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.

    EX:The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secu ...

随机推荐

  1. [luogu] 斐波那契数列

    https://www.luogu.org/problemnew/show/P1962 矩阵快速幂加速 #include <bits/stdc++.h> using namespace s ...

  2. 爬虫(十七):scrapy分布式原理

    一:scrapy工作流程 scrapy单机架构: 单主机爬虫架构: 分布式爬虫架构: 这里重要的就是我的队列通过什么维护?这里一般我们通过Redis为维护,Redis,非关系型数据库,Key-Valu ...

  3. python 使用PyKDL 四元数转欧拉角

    安装: sudo apt-get install ros-indigo-kdl-parser-py 使用: import PyKDLimport math def quat_to_angle(quat ...

  4. Java基础系列 - 泛型和反射机制

    package com.test5; import java.lang.reflect.Field; import java.lang.reflect.Method; /** * Java泛型和反射机 ...

  5. (转)SmartPing:一个服务器Ping值监测工具

    官网:https://docs.smartping.org/ 借鉴:https://www.moerats.com/archives/710/ 说明:之前博主发过一个雨落大神写的Ping值监测工具uP ...

  6. 使用WebSocket实现服务端和客户端的通信

    开发中经常会有这样的使用场景.如某个用户在一个数据上做了xx操作, 与该数据相关的用户在线上的话,需要实时接收到一条信息. 这种可以使用WebSocket来实现. 另外,对于消息,可以定义一个类进行固 ...

  7. STM32F4 LTDC

    首先配置同步时序先看参考手册 下面看一个实际例子,一块439的开发板 设置: 配置时序 LTDC_InitStruct.LTDC_HorizontalSync = ; /* */ LTDC_InitS ...

  8. node express返回json数据给前端

    请注意,使用res.json()的格式 1.前面不能添加  res.writeHead(200, {'content-type': 'text/plain;charset=utf-8'}); axio ...

  9. osg 3ds模型加载与操作

    QString item1 = QString::fromStdString(groupParam->getChild(k)->getName()); QStandardItem* ite ...

  10. Greenwich.SR2版本的Spring Cloud Ribbon实例

    上次我们了解了eureka(参见Greenwich.SR2版本的Spring Cloud Eureka实例),里面的服务消费方(服务实例a-beautiful-client)我们其实已经用到了ribb ...