Visual Studio 2015 - 调试 HTTP 连接问题

Visual Studio 2015 - Debug with HTTP connection problems

我有一个程序(控制台应用程序)利用 LinqToTwitter 阅读一些推文。当我调试程序时出现错误 "The underlying connection was closed: An unexpected error occurred in a submission".

消息 = 发送请求时出错。 消息 = 基础连接已关闭:发生意外发送错误。

如果我构建程序,我可以 运行 该程序没有任何问题。我已经研究过了,找不到问题所在。它与 TLS 1.2 有关系吗?我如何在 Visual Studio 中设置?我使用 VS 2015.

现在您提到 TLS 1.2 并且您使用的是 Visual Studio 的旧版本,这是有道理的。将此添加到您的 Main 过程中:

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12

Twitter 刚刚切换到 TLS 1.2。