解决“The remote certificate is invalid according to the validation procedure”问题
在用HttpClient发起https请求时,遭遇了“The remote certificate is invalid according to the validation procedure”异常,异常信息如下:
Exception Details: System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure. [AuthenticationException: The remote certificate is invalid according to the validation procedure.]
System.Net.TlsStream.EndWrite(IAsyncResult asyncResult) +8622023
System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar) +225 [WebException: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.]
System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult, TransportContext& context) +3564749
System.Net.Http.HttpClientHandler.GetRequestStreamCallback(IAsyncResult ar) +155
HttpClient调用代码如下:
var httpClient = new HttpClient();
var httpContent = new FormUrlEncodedContent(new
Dictionary<string, string>
{
{"grant_type", "client_credentials"}
});
var response = await httpClient.PostAsync("https://...", httpContent);
解决方法:
在web.config中添加如下的配置:
<system.net>
<settings>
<servicePointManager checkCertificateName="false" checkCertificateRevocationList="false" />
</settings>
</system.net>
解决“The remote certificate is invalid according to the validation procedure”问题的更多相关文章
- The remote certificate is invalid according to the validation procedure 远程证书验证无效
The remote certificate is invalid according to the validation procedure 根据验证过程中远程证书无效 I'm calling ...
- (转)The remote certificate is invalid according to the validation procedure
If you get “The remote certificate is invalid according to the validation procedure” exception while ...
- .net core中Grpc使用报错:The remote certificate is invalid according to the validation procedure.
因为Grpc采用HTTP/2作为通信协议,默认采用LTS/SSL加密方式传输,比如使用.net core启动一个服务端(被调用方)时: public static IHostBuilder Creat ...
- 异常处理之“The remote certificate is invalid according to the validation praocedure.”
参考文章:http://brainof-dave.blogspot.com.au/2008/08/remote-certificate-is-invalid-according.html 参考文章:h ...
- use AP_VENDOR_PUB_PKG.Update_Vendor_Site_Public to u ORA-01722: invalid number in Package AP_VENDOR_PUB_PKG Procedure Update_Vendor_Site_Public
ORA-01722: invalid number in Package AP_VENDOR_PUB_PKG Procedure Update_Vendor_Site_Public 发现此问题的经过: ...
- 解决MAC下xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools)的问题
将系统升级到了最新10.13.3 macOS High Sierra后,在使用ctags命令时会出现如下问题: xcrun: error: invalid active developer path ...
- 解决WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!
问题: 当我想要利用win10本地的cmd进行: ssh root@192.168.1.230 时,出现了如下错误: C:\Users\Raodi>ssh root@192.168.1.230 ...
- 解决cvc-complex-type.2.4.a: Invalid content was found starting with element
今天用myeclipse导入 一个项目出现后出现cvc-complex-type.2.4.a: Invalid content was found starting with element 'inf ...
- 解决"The remote SSH server rejected X11 forwarding request"问题
今天突然想起来好久没有登录我的vps了,于是下载了xshell,填入地址登录后,看到提示"WARNING! The remote SSH server rejected X11 forwar ...
随机推荐
- python print 不换行
#!/usr/bin/python # -*- coding: UTF- -*- ,): ,i+): print "%d * %d = %2d\t" % (j, i, i*j), ...
- RelativeLayout用代码兑现布局
RelativeLayout用代码实现布局TextView txt1 = new TextView(this); RelativeLayout.LayoutParams params = n ...
- nginx+tomcat实现负载均衡以及session共享(linux centos7环境)
一.nginx的安装 1.准备三份tomcat tomcat1 设置端口 8080 tomcat2 设置端口 8081 tomcat3 设置端口 8082 2. 下载nginx 3. 解压到/home ...
- 【转】struts2.5框架使用通配符指定方法(常见错误)
在学习struts框架时经常会使用到通配符调用方法,如下: <package name="shop" namespace="/" extends=&quo ...
- mac Virtualbox Ubuntu 设置共享目录
如果要用VirtualBox自带的共享文件夹功能,必须先安装Guest Additions.安装方法:置顶的菜单条->devices->Install Guest Additions.点击 ...
- mongodb php auto increment 自增
mongodb的自增实现根oracle,postgresql是差不多,都是通过计数器来实现的. oracle自增实现: 实例说明oracle序列用法 postgresql自增实现: postgresq ...
- Socket.BeginConnect 方法
Socket.BeginConnect 方法 (IPAddress, Int32, AsyncCallback, Object) 开始一个对远程主机连接的异步请求. 主机由 IPAddress 和端口 ...
- NodeJs生成SVG图形验证码
背景:短信接口有调用限制,如果受到恶意攻击,很容易就爆掉,所以需要一系列验证机制,后端采用签名加密的方式,而前端要做人机识别,有两个要求: 1)不能使用文本式的验证码,很简单就能拿到 2)所有验证逻辑 ...
- python--dict和set类型--4
原创博文,转载请标明出处--周学伟http://www.cnblogs.com/zxouxuewei/ 一.什么是dict 我们已经知道,list 和 tuple 可以用来表示顺序集合,例如,班里同学 ...
- Linux同步网络时间
1.date '+%Y%M%D' 按照格式显示当前日期,结果如下: [root@LAMP ~]# date "+%Y-%m-%d %H:%M:%S" -- :: 2.date -s ...