0
votes

I'm trying to establish connection between azure web app for containers and redis database. I have created a redis database using redislabs (Redis Enterprise Cloud hosted in Azure) and free subscription plan.

I can connect to the redis db from my local machine, but I cannot from the docker container running in Azure. I am not using TLS encryption because it's not supported by free subscription in database configuration.

Azure Service App location is west europe, redis is east us.

My application is asp.net 5 and here is my configuration. (I'm using StackExchange.Redis 5.0.0)

services.AddStackExchangeRedisCache(x =>
                {
                    x.ConfigurationOptions = new ConfigurationOptions
                    {
                        Password = config.Password,
                        EndPoints =
                        {
                            config.ConnectionString
                        },
                        KeepAlive = 180
                    };
                });

Here is an error that I have when trying to set a key in database.

StackExchange.Redis.RedisConnectionException: It was not possible to connect to the redis server(s).  There was an authentication failure; check that passwords (or client certificates) are configured correctly. AuthenticationFailure (None, last-recv: 231) on redis-18894.c251.east-us-mz.azure.cloud.redislabs.com:18894/Interactive, 
Flushed/ComputeResult, last: ECHO, origin: SetResult, outstanding: 0, last-read: 0s ago, last-write: 0s ago, keep-alive: 60s, state: ConnectedEstablishing, mgr: 9 of 10 available, 
last-heartbeat: never, global: 0s ago, v: 2.0.593.37019  
at StackExchange.Redis.ConnectionMultiplexer.ConnectImplAsync(Object configuration, TextWriter log) 
in C:\projects\stackexchange-redis\src\StackExchange.Redis\ConnectionMultiplexer.cs:line 823
at Microsoft.Extensions.Caching.StackExchangeRedis.RedisCache.ConnectAsync(CancellationToken token)  
at Microsoft.Extensions.Caching.StackExchangeRedis.RedisCache.SetAsync(String key, Byte[] value, DistributedCacheEntryOptions options, CancellationToken token)

May be I can only connect using TSL, because inside TLS/SSL settings in App Service I have Minimum TLS Version = 1.2

Thanks!

1

1 Answers

0
votes

App service configuration is absolutely nothing to do with how you you're connecting to redis. Please make sure you use port 80 to connect to redis. Please refer this while making connection with redis. using StackExchange.Redis;

readonly ConnectionMultiplexer muxer = ConnectionMultiplexer.Connect("hostname:port,password=password"); IDatabase conn = muxer.GetDatabase();