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
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