我有一个很奇怪的问题,现在花了我一天时间。
错误异常。
System.Net.WebException: The request was aborted: Could not create SSL/TLS secure channel.
at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)
at System.Net.HttpWebRequest.GetRequestStream()
at RestSharp.Http.WriteRequestBody(HttpWebRequest webRequest)
at RestSharp.Http.PostPutInternal(String method)
at RestSharp.RestClient.Execute(IRestRequest request, String httpMethod, Func`3 getResponse)我的代码是在测试环境上工作,而不是在本地环境上工作。代码在过去起了作用,没有什么改变。我在SoapUi的本地机器上复制了其余的调用,它在那里工作。我导入了SSL证书等.我的本地机器正在运行Windows 7和测试环境Windows 2008.这两个环境都在运行.NET Framework4.5。
我在互联网上搜索了一个解决方案,我发现了很多,例如The request was aborted: Could not create SSL/TLS secure channel http://robertgreiner.com/2013/03/could-not-establish-trust-relationship-for-the-ssl-tls-secure-channel/
我尝试了可能的解决办法,但我没有解决这个问题。有人知道解决办法吗?
非常感谢,乔迪
发布于 2015-10-05 11:57:13
SSL证书的加密密钥太低/太差,因此Windows在几次Windows更新后不再接受它。解决方案是用更高的加密密钥更新SSL证书。
发布于 2015-08-31 16:19:46
在您的测试环境和其他服务器的握手过程中,似乎存在问题。
在调用服务器之前尝试这样做:
ServicePointManager.ServerCertificateValidationCallback =
(s, certificate, chain, sslPolicyErrors) => true;PS:上面的行将禁用SSL验证。
https://stackoverflow.com/questions/32315031
复制相似问题