4 个解决办法,我用的第四个方法就解决了, 注册表手动添加的 重启后不管用,第四个方法 直接用程序改一下方便 首先得保证服务器是否支持 tls1.2 去注册表里查或者百度怎么查,基本大多数都用的是1.2 1. 代码前加这个 ServicePointManager.Expect100Continue = true; ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | (SecurityProtocolType)0x300 //Tls11 | (SecurityProtocolType)0xC00; //Tls12 2. 复制下面注册表代码导入到注册表。新建txt,将后缀txt改为reg(注册表项),导入 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\WinHttp] 3. 升级 到 fromwork4.6 版本 4. https://www.nartac.com/Products/IISCrypto/Download 去下载这个软件 打开软件后 都选上确定 重启就好了
相关文章 英文搜索关键词 : the request was aborted could not create ssl/tls (net 4.6) statckoverflow 上面大多答案如下: 也有用如下的(强烈不建议使用) 原因: Tls1.0 由于安全原因,大部分https服务端已经不再建议支持。 .Net 4.5及之前的版本,不支持Tls1.2 ,SecurityProtocolType这个枚举中没有Tls12这个项 Windows Server 2012 R2中,安装了.Net 4.6.x或4.7.x后,虽然系统支持,.Net也支持,但是默认的协商协议列表不包含Tls1.2 解决方案(PowerShell脚本): 查看当前系统中默认启用的协商协议列表 打印出来的结果应该是不包含Tls12 的,我实测的Win10 1603以及Windows Server 2012 R2显示均为如下: 继续执行如下代码,修改设置: 针对64位.Net:
针对32位.Net:
关闭PowerShell窗口,打开一个新的PowerShell窗口,执行以下代码
结果如下:
重启之前受影响的.Net应用程序即可生效 .Net <4.5.x 参考链接 https://stackoverflow.com/questions/27953681/changing-security-protocol-per-request-httpclient .Net 4.6.x参考链接 https://trailheadtechnology.com/solving-could-not-create-ssl-tls-secure-channel-error-in-net-4-6-x/ 官方资料:https://docs.microsoft.com/en-us/security/solving-tls1-problem
推荐阅读更多精彩内容
|