无法为本地主机创建 SSL/TLS 安全通道

问题描述

我有一个奇怪的问题,我可以使用 WebClient 或 HttpClient 成功连接到我的远程服务器。但是,当我尝试连接到 localhost 并且无法创建 SSL/TLS 通道时,相同的代码不起作用。当我在没有 SSL 的情况下运行 localhost 时,我可以连接到 localhost。

(a) http 适用于我的远程运行的服务器和本地主机 (b) https 适用于我的远程运行的服务器,而不适用于 localhost

我使用的参数是:

ServicePointManager.MaxServicePointIdleTime = 0;
ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls12;

ServicePointManager.ServerCertificateValidationCallback +=
          (sender,certificate,chain,errors) =>
          {
              return true;
          };

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)