0
votes

I'm trying to connect to an Azure Cache For Redis resource from an asp.net MVC application using StackExchange.Redis and it only works if I set the port to 6379 and ssl=false in the connection string.

public class RedisCacheHelper
{
    static RedisCacheHelper()
    {
        lazyConnection = new Lazy<ConnectionMultiplexer>(() =>
        {
            return ConnectionMultiplexer.Connect(****.redis.cache.windows.net:6380,password=******=,ssl=True,abortConnect=False);
        });
    }

    private static Lazy<ConnectionMultiplexer> lazyConnection;

    public static ConnectionMultiplexer Connection
    {
        get
        {
            return lazyConnection?.Value;
        }
    }
}   

When I try to connect using ssl=true and the ssl port I get:

"No connection is active/available to service this operation: GET ******; A blocking operation was interrupted by a call to WSACancelBlockingCall, mc: 1/1/0, mgr: 10 of 10 available, clientName: DESKTOP-EMHQA7J, IOCP: (Busy=0,Free=1000,Min=12,Max=1000), WORKER: (Busy=1,Free=8190,Min=12,Max=8191), v: 2.2.4.27433"}

This docs say I should have a .key or .pfx file but I don't see where I can get such file from Azure. https://docs.redislabs.com/latest/rs/references/client_references/client_csharp/

1

1 Answers

0
votes

You don't need .pfx or .key file.

You can download my sample code, and it works for me.

enter image description here

In local,

enter image description here

After deployed,

enter image description here

For more details, pls check below post. The sample code is same as you.

Encrypting and decrypting values in Azure redis cache