Suresh Devathi
Suresh Devathi

Reputation: 31

REDIS Connection Error : Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host

We are using ServiceStack.Redis V 4.0.50.0 dll to connect the Azure Cache REDIS. Using the .NET Framework 4.5 and Visual Studio 2013. We want to upgrade the TLS Version 1.0 to TLS V1.2. After changing the version my code is not working. Getting the below error

System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host.

Added sslprotocols in connection string but it'not worked.

Tried to add the below one no luck. ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

Please help us where I need to add the code to support my code TLS V1.2. March 30 is the last for this.

Regards, Suresh +91 9000480011

Upvotes: 3

Views: 1420

Answers (1)

mythz
mythz

Reputation: 143284

The ability to change SSL Protocols was added in v5.6 which can be done on the connection string using the ?sslprotocols option, e.g:

var connString = $"redis://{Host}?ssl=true&sslprotocols=Tls12&password={Password.UrlEncode()}";
var redisManager = new RedisManagerPool(connString);
using (var client = redisManager.GetClient())
{
    //...
}

Upvotes: 1

Related Questions