It was not possible to connect to the redis server(s); to create a disconnected multiplexer, disable AbortOnConnectFail. SocketFailure on PING

15,303

Solution 1

Azure Redis Cache only enables the SSL endpoint by default. The most secure approach is to set "ssl=true" when calling ConnectionMultiplexer.Connect().

Alternatively, you can use the Azure Portal to enable the non-SSL endpoint on your Azure Redis Cache, but then your password and all data will be sent in clear text.

Solution 2

I had exact same exception and it turned out to be corporate firewall, which is blocking port 6379, 6380.

I copied my test console app in an environment outside company network and connection was successful. So if Redis server is running on the internet and your network is behind a firewall make sure the ports are open.

Share:
15,303
Luis Valencia
Author by

Luis Valencia

Updated on June 14, 2022

Comments

  • Luis Valencia
    Luis Valencia almost 2 years

    I am trying to make a simple example of reading and writing from azure redis cache and I get this error

    An exception of type 'StackExchange.Redis.RedisConnectionException' occurred in StackExchange.Redis.dll but was not handled in user code

    Additional information: It was not possible to connect to the redis server(s); to create a disconnected multiplexer, disable AbortOnConnectFail. SocketFailure on PING

    The code I am using is this, I changed dns and password

    // Get Connection instance
    ConnectionMultiplexer connection = ConnectionMultiplexer
        .Connect("xx.redis.cache.windows.net,ssl=false,password=...");
    // Get database
    IDatabase databaseCache = connection.GetDatabase();
    // Add items
    databaseCache.StringSet("foo1", "1");
    databaseCache.StringSet("foo2", "2");
    // Add items with experation value
    databaseCache.StringSet("foo3", "3", TimeSpan.FromMinutes(20));
    
    Stopwatch sw = new Stopwatch();
    
    sw.Start();
    
    // Get item value
    string foo1Value = databaseCache.StringGet("foo1");
    
    sw.Stop();
    
    Console.WriteLine("Elapsed={0}", sw.Elapsed);
    return View();