0
votes

I have been stuck on this very issue for nearly 2 days. It crashes when it tries to connect (shown in code below). I am getting an exception that says :

StackExchange.Redis.RedisConnectionException: 'It was not possible to connect to the redis server(s). UnableToConnect on 127.0.0.1:6379/Interactive, Initializing/NotStarted, last: NONE, origin: BeginConnectAsync, outstanding: 0, last-read: 0s ago, last-write: 0s ago, keep-alive: 60s, state: Connecting, mgr: 10 of 10 available, last-heartbeat: never, global: 5s ago, v: 2.1.30.38891'

The code is in the StartUp file.

            services.AddSingleton<ConnectionMultiplexer>(c =>
        {
            var configuration = ConfigurationOptions.Parse(Configuration.GetConnectionString("Redis"));

            return ConnectionMultiplexer.Connect(configuration);
        });

UPDATE

enter image description here

DOCKER COMPOSE

ersion: '3.4'

services:
  authdb:
    image: redis  
  authentication.api:
    image: ${DOCKER_REGISTRY-}authenticationapi
    build:
      context: .
      dockerfile: Authentication.API/Dockerfile

DOCKER COMPOSE OVERRIDE

version: '3.4'

services:
  authdb:
    container_name: authdb
    restart: always
    ports:
      - "6379:6379"
  authentication.api:
    environment:
      - ASPNETCORE_ENVIRONMENT=Development
      - "ConnectionStrings:Redis=authdb:6379"
      - ASPNETCORE_URLS=https://+:443;http://+:80
    ports:
      - "80"
      - "443"
    volumes:
      - ${APPDATA}/ASP.NET/Https:/root/.aspnet/https:ro
1
do you actually have a redis server running locally on port 6379?David L
@DavidL I am new to Redis. And I don't think I have Redis running locally. Is there a way to check ?Illep
Redis is a separate application. It isn’t like a memory cache that runs in your web app. So if you haven’t explicitly set one up, you most likely don’t have a redis instance provisioned.David L
I have added an image of my Docker application. Can you please have a look. I guess the instance is running.Illep
How is your redis instance bound? There’s no way for anyone to know how you’ve configured it.David L

1 Answers

0
votes

if you have an other container, connect to the container using the Azure portal, (attach). Make sure you have ping installed

do apt install iputils-ping now do a ping to authdb see if ping can resolve.

enter image description here