我已经在这个问题上纠缠了将近两天了。它在尝试连接时崩溃(如下面的代码所示)。我得到一个例外,说:
stackexchange.redis.redisconnectionexception:'无法连接到redis服务器。无法连接127.0.0.1:6379/interactive,initialization/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'
代码在启动文件中。
services.AddSingleton<ConnectionMultiplexer>(c =>
{
var configuration = ConfigurationOptions.Parse(Configuration.GetConnectionString("Redis"));
return ConnectionMultiplexer.Connect(configuration);
});
更新
Docker
版本:'3.4'
services:
authdb:
image: redis
authentication.api:
image: ${DOCKER_REGISTRY-}authenticationapi
build:
context: .
dockerfile: Authentication.API/Dockerfile
docker编写覆盖
版本:'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
暂无答案!
目前还没有任何答案,快来回答吧!