Shabir jan
Shabir jan

Reputation: 2427

Azure Redis Connection Issue

I am trying to access my live Azure Redis Cache Instance inside Visual Studio for locally debugging, I am using StackExchange.Redis but I am getting this error whenever i try to access my cache value

StackExchange.Redis.RedisConnectionException: No connection is available to service this operation: GET 100014; UnableToConnect on cache.redis.cache.windows.net:6380/Interactive, Initializing/NotStarted

I have enabled Non SSL on my Redis cache on port 6379 as well, I have tried running my WebApi Locally with SSL as well (Enabled in Visual Studio). The weird part is I am able to connect to same Redis instance using Console application but not with my .Net Core Web APi Project.

private static Lazy<ConnectionMultiplexer> lazyConnection = new Lazy<ConnectionMultiplexer>(() =>
    {
        string cacheConnection = "key";
        return ConnectionMultiplexer.Connect(cacheConnection);
    });

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

Azure Redis Cache Settings in Azure Portal

More weird part is I am able to connect to same Redis instance using Redis Cli.

Upvotes: 0

Views: 1816

Answers (1)

Armando Bracho
Armando Bracho

Reputation: 729

Your connection code looks fine, I believe your issue might be the cache connection you are using as you are only passing on the key, but it should look something like this:

string cacheConnection = host:port,password=YOUR_KEY,ssl=True,abortConnect=False

in your case set the ssl to false if you wish and the port accordingly

Upvotes: 0

Related Questions