我正在尝试在azure web app for containers和redis database之间建立连接。我使用 redislabs(托管在 Azure 中的 Redis Enterprise Cloud)和免费订阅计划创建了一个 redis 数据库。
我可以从本地计算机连接到 redis db,但不能从 Azure 中运行的 docker 容器连接。我没有使用 TLS 加密,因为数据库配置中的免费订阅不支持它。
Azure Service App 的位置是西欧,redis是我们东边。
我的应用程序是 asp.net 5,这是我的配置。(我正在使用 StackExchange.Redis 5.0.0)
services.AddStackExchangeRedisCache(x =>
{
x.ConfigurationOptions = new ConfigurationOptions
{
Password = config.Password,
EndPoints =
{
config.ConnectionString
},
KeepAlive = 180
};
});
这是我在尝试在数据库中设置密钥时遇到的错误。
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)
可能我只能使用 TSL 进行连接,因为在应用服务中的 TLS/SSL 设置中,我的 最低 TLS 版本 = 1.2
谢谢!