我有一个.net 4.0 Windows服务,可以在两个不同的系统之间进行通信。一种是现在的服务,一种是消息传递总线。

现在,服务正在强制tls 1.2(应如此)。通过添加ServicePointManager.SecurityProtocol =(SecurityProtocolType)768,我们将代码更新为使用1.1或1.2。 (SecurityProtocolType)3072;

问题是,消息总线已旧并且使用1.0。

有两种方法都可以支持吗?如果我升级到.net 4.7,它将适用于所有协议吗?

谢谢

最佳答案

如果服务器不支持TLS1.2,它将尝试TLS1.1;如果服务器不支持TLS1.1,它将尝试TLS1.0。这将使您能够使用最佳协议,并在服务器不支持的情况下回退(如您的情况)。

ServicePointManager.SecurityProtocol =
    SecurityProtocolType.Tls |
    (SecurityProtocolType)768 |
    (SecurityProtocolType)3072;



  有两种方法都可以支持吗?如果我升级到.net 4.7,它将正常工作
  适用于所有协议?


是的(就您的问题而言,是任何和所有内容),我相信.Net 4.5及更高版本可以做到这一点...

ServicePointManager.SecurityProtocol =
            SecurityProtocolType.Tls |
            SecurityProtocolType.Tls11 |
            SecurityProtocolType.Tls12;

关于c# - 带有.net Framework 4.0的Tls 1.2或Tls 1.0,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/58019568/

10-11 07:59