Tom Davies
Tom Davies

Reputation: 899

Unable to connect to Azure Redis Cache with SSL

Connecting to Azure Redis Cache like this, on Owin application startup...

var options = ConfigurationOptions.Parse(cacheConnectionString);
var kernel = new StandardKernel();
kernel.Bind<ConnectionMultiplexer>().ToMethod(context =>
{
    return ConnectionMultiplexer.Connect(options);
}).InSingletonScope();

Which works absolutely fine for Redis running on my local machine, or for Azure Redis with SSL turned off. However, as soon as I change the connection string from:

xyz.redis.cache.windows.net,ssl=false,password=abcdefghxyz=

to

xyz.redis.cache.windows.net,ssl=true,password=abcdefghxyz=

It throws:

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

I'm using StackExchange.Redis version 1.0.316.0 from NuGet. I've tried...

I'm all out of ideas for what could possibly be going wrong now though. Hopefully it's something trivial I've missed, but just can't see it!

Edit
I ran the ConnectToAzure() unit test, passing in my cache name and password and it passed. So I'm almost certainly doing something silly here.

Edit 2
It also works from a console application without any issues.

Upvotes: 0

Views: 2552

Answers (1)

Tom Davies
Tom Davies

Reputation: 899

I fixed it, super-weird situation but I'll answer just in case someone else is ever sat equally as confused as I've been.

The project was previously a web role in an Azure Cloud Service, which had In-role caching enabled. We moved it to a standalone Azure Web App, but never got around to removing all the unnecessary references that were left over.

Removing Microsoft.WindowsAzure.ServiceRuntime and Microsoft.WindowsAzure.Diagnostics miraculously got it working.

Upvotes: 2

Related Questions