我有一个集成到某些服务和API的Web应用程序。不幸的是,其中一些服务仅支持通过TLS 1.1进行通信,而较新的服务则需要TLS 1.2。
我尝试添加以下初始化代码:
ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12
甚至是受支持协议的完整列表:
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12
在两种情况下,似乎框架仅尝试使用Tls12。当我尝试与较旧的服务进行通信时,会引发以下异常:
The request was aborted: Could not create SSL/TLS secure channel.
如何同时启用两个协议?我希望找到一种可以激活某种自动回退的解决方案……