我正在尝试在全新安装的 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);
我不断从客户端收到错误:请求已中止:无法创建 SSL/TLS 安全通道
。我以为存在证书问题,直到我最终进行了数据包捕获并发现没有共同的密码套件。 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;
关于c# - RestSharp:无法创建 SSL/TLS 安全通道,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18947373/