c# - RestSharp:无法创建 SSL/TLS 安全通道

标签 c# ssl restsharp windows-8.1

我正在尝试在全新安装的 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/

相关文章:

c# - 在 C# 中按月对数据进行分组和计数

c# - 显示 Entity Framework 为插入/更新生成的 SQL

c# - RestSharp ASYNC client.ExecuteAsync<T> () 工作示例

oauth - 如何在OAuth中使用RestSharp?

c# - 安装 .net Framework 4.7.2 时,4.5.1 应用程序中的 TLS1.2 协商失败

ssl - 如何通过 HTTPS/SSL 运行 Svelte/Sapper 应用程序?

node.js - "refused to connect"带 https 并让我们加密

java - SSL : Received fatal alert: handshake_failure

c# - 使用 RestSharp 和 WebAPI 进行数据流传输

c# - 当 DropDownList Filter 的值不是 ALL 时,如何删除 GridView 中的整个第一列?