2

I have install PM> Install-Package ServiceStack.Redis and used following code to connect azure redis cache.

I think I missed connection string as I have not given PRIMARY KEY in host

string host = "mydemo.redis.cache.windows.net";
            var redisManager = new PooledRedisClientManager(host);
            using (var redisClient = redisManager.GetClient())
            {
                IRedisTypedClient<Customer> redis = redisClient.As<Customer>();

Getting error :

{"could not connect to redis Instance at mydemo.redis.cache.windows.net:6379"}

A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 11.22.216.225:6379

Neo
  • 15,491
  • 59
  • 215
  • 405

1 Answers1

3

This is a basic network connection error. You need to ensure that you have access to connect to TCP port 6379 on mydemo.redis.cache.windows.net (11.22.216.225:6379) and open up any firewall rules as necessary.

You can test TCP connections with telnet or by running redis-cli.exe (from redis-windows) on the same server you're trying to use ServiceStack.Redis, e.g:

redis-cli -h 11.22.216.225 -p 6379

SSL Redis Connections to Azure Redis

The connection string if you're trying to connect to a redis-server on Azure is typically in the format:

{AzureRedisKey}@servicestackdemo.redis.cache.windows.net?ssl=true 

The ?ssl=true option says to use SSL on the default port Azure SSL port 6380.

mythz
  • 141,670
  • 29
  • 246
  • 390