[bug]The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.
写在前面
在模拟请求的时候,如果url为https的,会报这个错误。大概错误就是:基础连接已关闭:无法建立信任关系的SSL / TLS的安全通道。
The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.
基础连接已关闭:无法建立信任关系的SSL / TLS的安全通道。
解决办法
在模拟请求的方法中加上这样一句话。
ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback((obj, certificate, chain, sslPolicyErrors) =>
{
return true;
});
参考:http://robertgreiner.com/2013/03/could-not-establish-trust-relationship-for-the-ssl-tls-secure-channel/
[bug]The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.的更多相关文章
- Web Server 使用WebClient 发送https请求 The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel
使用WebClient 发送https请求 使用WebClient发送请求时,并且是以https协议: WebClient webClient = new WebClient(); string re ...
- 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 ...
- WebException: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel
关于这个异常的问题网上有很多的解决方案. 最为靠谱的有: http://www.cnblogs.com/hjf1223/archive/2007/03/14/674502.html(若因为链接而导致不 ...
- 微信接口问题(The underlying connection was closed: An unexpected error occurred on a send)
突然在调用微信接口是报:The underlying connection was closed: An unexpected error occurred on a send错误,跟踪了半天,是因为 ...
- [WebException: The underlying connection was closed: The message length limit was exceeded.]解决方法
[WebException: The underlying connection was closed: The message length limit was exceeded.] Syste ...
- The underlying connection was closed: An unexpected error occurred on a send
操作系统是Windows Server 2003 x64 SP2,使用Framework 4.0,在使用WebClient访问某些特定的HTTPS站点时,会引发异常: Unhandled Except ...
- windows xp .net framework 4.0 HttpWebRequest 报The underlying connection was closed,基础连接已关闭
windows xp .net framework 4.0 HttpWebRequest 报The underlying connection was closed,基础连接已关闭,错误的解决方法 在 ...
- C#使用FtpWebRequest 基础连接已经关闭:连接被意外关闭(The underlying connection was closed:The connection was closed unexpectedly)
公司内部开发的winform程序使用了FtpWebRequest下载FTP服务器的文件到本地. 大多数人运行良好,由于我们是试运行逐步有人加入到平台的使用,前两天突然有个别机器无法连接FTP服务器报出 ...
- Json Post到 https的坑 - the underlying connection was closed an unexpected error occurred on a send(远程服务器未知错误导致关闭)
最近做了一个安装包,安装包会弹出dotnet的 窗体,这个安装包会去调用https的一个api.用测试程序测试窗体都是好的.一旦打入安装包后,就报错.研究了半天,原来是https惹的祸 解决方案: . ...
随机推荐
- android自定义控件属性
有两种方法为自定义的控件设置属性 . 来自为知笔记(Wiz)
- 进程管理利器Supervisor--入门简介
目录 概述 Supervisor是什么 Supervisor意图 Supervisor特性 Supervisor组件 平台需求 概述 项目运行需要后台运行,一般都是使用 nohup,但是nohup不能 ...
- 真·APIO2018滚粗记
有人说只有大佬才会说滚粗啊爆零啊…… 然而我真滚粗真爆零啊…… D1: 听课,然后夏眠. 咦折纸……哦好吧太神仙了. 咦AI……好妙啊好妙啊. 咦二分……哇还有wqs二分这种神奇操作,学学学. (我是 ...
- winform中key读取修改
根据key name的名称读取value-----读取使用ConfigurationManager.AppSettings读取容易没读取到根目录中的key public string GetXml(s ...
- phantomjs和selenium模拟登陆qq空间
# -*- coding: utf-8 -*- from selenium import webdriver import time driver =webdriver.PhantomJS() dri ...
- 「BZOJ4029」[HEOI2015] 定价 贪心
「BZOJ4029」[HEOI2015] 定价 2015年4月28日2,7490 Description 在市场上有很多商品的定价类似于 999 元.4999 元.8999 元这样.它们和 1000 ...
- sublime 设置代码片段不起作用的问题
最近爱上了sublime 但是我也继续爱我的Vscode 安装sublime代码片段的时候,遇到了设置好的代码片段按 Tab建 不起作用的问题.快折磨死的时候灵光一闪: 首先检查设置的代码片段 &l ...
- View的三次measure,两次layout和一次draw
我在<Android视图结构>这篇文章中已经描述了Activity,Window和View在视图架构方面的关系.前天,我突然想到为什么在setContentView中能够调用findVie ...
- css3文件树
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...
- JS多个函数之间传递参数问题
JS多个函数之间传递参数的一个重要思想是在页面定义一个隐藏域,当第一个函数请求到数据时候修改隐藏域的值,第二个函数用jQuery的选择器选择页面中隐藏域的值. 比如: 页面中定义一个隐藏的页号. &l ...