我尝试在全新安装的 Windows 8.1 上使用 Visual Studio 2012 Express 中的 RestSharp。我尝试使用的 API 仅支持 SSL 的 RC4-SHA。证书有效。
var client = new RestClient();
client.BaseUrl = "https://teststore.mybigcommerce.com/api/v2/";
client.Authenticator = new HttpBasicAuthenticator("username", "key");
var request = new RestRequest();
request.Resource = "time.json";
IRestResponse response = client.Execute(bcrequest);
我不断收到客户端的错误:The request was aborted: Could not create SSL/TLS secure channel
。我以为存在证书问题,直到我最终捕获数据包并发现没有共同的密码套件。 RC4-SHA 在客户端不可用。安装 Windows 7 并运行完全相同的代码后,问题就消失了。
为什么 RC4-SHA 在 Windows 8.1 上的 RestSharp 中不可用?
我总是在进行初始网络连接之前添加以下代码行来解决此问题。
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12 | System.Net.SecurityProtocolType.Tls11 | System.Net.SecurityProtocolType.Tls11;
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)