系统从.net framework 升级到dotnet core2.1

原先工作正常的httpclient,会报SSL connection could not be established error 错误

在.net framework中通过ServicePointManager,当证书出错时,可以跳过证书验证。

ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true

升级到dotnet core 2.1后,发现以上配置无效。

  原因是ServicePointManager只对HttpWebRequest有效,.net framework中httpclient是基于HttpWebRequest实现的,所以Httpclient不会报错

在dotnetcore2.1中,Httpclient想要实现相同的功能,需要在HttpClient中设置。

 var handler = new HttpClientHandler
{
ServerCertificateCustomValidationCallback = delegate { return true; }
};

github上有人提过这个问题,可以参见 https://github.com/dotnet/corefx/issues/29452

HttpClient SSL connection could not be established error的更多相关文章

  1. NetCore HttpClient The SSL connection could not be established, see inner exception

    之前遇到一个问题 https://www.cnblogs.com/leoxjy/p/10201046.html 在centos 7.x  HttpClient访问会出问题  The SSL conne ...

  2. The request with exception: The SSL connection could not be established, see inner exception. requestId 解决方案

    DOTNET CORE 部署 Centos7 抛出异常 环境变量如下: .NET Core SDK (reflecting any global.json): Version: 2.2.401 Com ...

  3. powercli The SSL connection could not be established, see inner exception. 问题解决

    Connect-VIServer -Server 这里是"SSL连接不能建立......"这实际上意味着你没有一个有效的证书.如果你想连接到vCenter没有一个有效的证书,您必须 ...

  4. mysql连接error,Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection .....

    完整error Establishing SSL connection without server's identity verification is not recommended. Accor ...

  5. WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default i

    jdbc连接数据库候,对数据进行访问,访问正常当出现如下警告: WARN: Establishing SSL connection without server's identity verifica ...

  6. Java连接Mysql数据库警告: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established

    详细错误: Establishing SSL connection without server's identity verification is not recommended. Accordi ...

  7. How an SSL connection is established

    An SSL connection between a client and server is set up by a handshake, the goals of which are: To s ...

  8. java链接Mysql出现警告:Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by

    Java使用mysql-jdbc连接MySQL出现如下警告: Establishing SSL connection without server's identity verification is ...

  9. 解决Establishing SSL connection without server‘s identity verification is not recommended.

    每次从数据库中进行查询或者其他操作控制台都会出现以下警告,虽说不是error,但是很显眼.. WARN: Establishing SSL connection without server's id ...

随机推荐

  1. 《游戏引擎构架Game Engine Architecture》略读笔记

    <游戏引擎构架Game Engine Architecture>略读笔记 分析标题作者 分析目录 选取感兴趣的章节阅读 25分钟略读完章节 分析标题作者 此书是一本帮助人入行做游戏的书,也 ...

  2. 27 多线程(一)——创建进程的三种方法、线程锁(同步synchornized与lock)

    线程的流程 线程的创建 有三种方法,重点掌握前两种: 继承Thread类 实现Runnable接口(推荐使用:避免单继承的局限性) 实现Callable接口 根据java的思想,要少用继承,多用实现. ...

  3. mysql 免费的图形管理工具

    在学习go语言开发时,使用了mysql 使用了两天mysql命令行,感觉实在是无法忍受, 找到了一个免费好用的 图形数据库管理工具SQLyog Professional 版本: 注册名:luoye25 ...

  4. JAVA线程Disruptor核心链路应用(八)

    import java.util.concurrent.atomic.AtomicInteger; /** * Disruptor中的 Event * @author Alienware * */ p ...

  5. ByteBuf源码

    ByteBuf是顶层的抽象类,定义了用于传输数据的ByteBuf需要的方法和属性. AbstractByteBuf 直接继承ByteBuf,一些公共属性和方法的公共逻辑会在这里定义.例如虽然不同性质的 ...

  6. Bootstraps 4 引入报错 Error: Bootstrap tooltips require Tether

    问题: 解决办法 (http://github.hubspot.com/tether/) Bootstrap 4 needs Tether, so you need to include tether ...

  7. node.js开发 1-概述

    https://www.cnblogs.com/gaoya666/p/9071288.html Nodejs英文网:https://nodejs.org/en/ 中文网:http://nodejs.c ...

  8. 使用jQuery开发accordion手风琴插件

    一.插件效果 手风琴插件常用的功能均已实现,包括:手风琴菜单项的折叠展开效果.选中指定菜单项.判断菜单项是否选中等. 效果如下: 二.插件内部HTML元素结构 <!-- accordioon组件 ...

  9. python 直角图标生成圆角图标

    参考链接:https://stackoverflow.com/questions/11287402/how-to-round-corner-a-logo-without-white-backgroun ...

  10. Ruby开发小记

    基础点 1.log打印 puts "Hello!" 2.拼接字符 value1 = "today" value2 = "#{value1} is Th ...