Unable to connect to redis from Console Application

0

I have redis server in a separate environment which can be connected via SSH tunnel. I could able to access the Redis server by using the Redis Desktop manager by giving the appropriate server address and password but I am not able to connect it from my Console Application. Below is the code I have used

ConnectionMultiplexer _connection = 
ConnectionMultiplexer.Connect("some_address,password=redis,abortConnect=false");
IDatabase _cache = _connection.GetDatabase(); 
_cache.StringSet("TestKey", "TestValue");

I am getting the below error while trying to insert a string value in the Redis database.

StackExchange.Redis.RedisConnectionException
  HResult=0x80131500
  Message=No connection is available to service this operation: SET CHeckingTest; UnableToConnect on some_address:6379/Interactive, Initializing/NotStarted, last: NONE, origin: BeginConnectAsync, outstanding: 0, last-read: 5s ago, last-write: 5s ago, keep-alive: 60s, state: Connecting, mgr: 10 of 10 available, last-heartbeat: never, global: 0s ago, v: 2.0.601.3402; IOCP: (Busy=0,Free=1000,Min=4,Max=1000), WORKER: (Busy=0,Free=2047,Min=4,Max=2047), Local-CPU: n/a
  Source=StackExchange.Redis
  StackTrace:
   at StackExchange.Redis.ConnectionMultiplexer.ExecuteSyncImpl[T](Message message, ResultProcessor`1 processor, ServerEndPoint server) in C:\projects\stackexchange-redis\src\StackExchange.Redis\ConnectionMultiplexer.cs:line 2237
   at StackExchange.Redis.RedisBase.ExecuteSync[T](Message message, ResultProcessor`1 processor, ServerEndPoint server) in C:\projects\stackexchange-redis\src\StackExchange.Redis\RedisBase.cs:line 54
   at StackExchange.Redis.RedisDatabase.StringSet(RedisKey key, RedisValue value, Nullable`1 expiry, When when, CommandFlags flags) in C:\projects\stackexchange-redis\src\StackExchange.Redis\RedisDatabase.cs:line 2407
   at Redis_sample.Program.Main(String[] args) in C:\Users\Anish George\Desktop\Redis\CacheComponent\Redis_sample\Program.cs:line 66

Inner Exception 1:
RedisConnectionException: UnableToConnect on some_address:6379/Interactive, Initializing/NotStarted, last: NONE, origin: BeginConnectAsync, outstanding: 0, last-read: 5s ago, last-write: 5s ago, keep-alive: 60s, state: Connecting, mgr: 10 of 10 available, last-heartbeat: never, global: 0s ago, v: 2.0.601.3402

Which password I should be giving? I have one password for SSH Tunnel and another password for Redis server also the port number is different. How can I connect ot Redis via the console application?

redis
asked on Stack Overflow Dec 13, 2019 by Anish • edited Dec 13, 2019 by Anish

1 Answer

0

You're using port 6379 which is usually used for unsecured traffic, it might be blocked on your server. Try using port 6380 instead.

answered on Stack Overflow Dec 19, 2019 by J Marlow

User contributions licensed under CC BY-SA 3.0