我们使用ServiceStack.Redis V 4.0.50.0 dll来连接Azure Cache REDIS。 使用.NET Framework 4.5和Visual Studio 2013。我们希望将TLS版本1.0升级到TLS V1.2。更改版本后我的代码无法运行。出现以下错误
System.IO.IOException:无法从传输连接读取数据:现有连接被远程主机强制关闭。 ---> System.Net.Sockets.SocketException: 远程主机强制关闭现有连接。
在连接字符串中添加了 ssl 协议(protocol),但不起作用。
尝试添加以下内容,但没有成功。 ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
请帮助我们在我需要添加代码以支持我的代码 TLS V1.2 的地方。 3 月 30 日是最后一次。
问候, 苏雷什 +91 9000480011
最佳答案
能够 change SSL Protocols was added in v5.6这可以使用 ?sslprotocols
选项在连接字符串上完成,例如:
var connString = $"redis://{Host}?ssl=true&sslprotocols=Tls12&password={Password.UrlEncode()}";
var redisManager = new RedisManagerPool(connString);
using (var client = redisManager.GetClient())
{
//...
}
关于servicestack - REDIS连接错误: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60775732/