Reputation: 16219
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
Upvotes: 2
Views: 3293
Reputation: 143319
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
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.
Upvotes: 3