我们在 Azure 上托管了一个 redis 缓存,我们在 .net 核心应用程序中使用以下内容作为服务:
services.AddSingleton<IConnectionMultiplexer>(provider =>
ConnectionMultiplexer.Connect(Configuration.GetConnectionString("RedisConnection"))
);
我们的连接字符串类似于以下内容:
ourserver.redis.cache.windows.net:6380,password=******=,ssl=True,abortConnect=False,syncTimeout=4000
从缓存中获取我们不会遇到问题,但是如果我们添加到缓存中,我们有时会遇到以下错误:
"StackExchange.Redis.RedisConnectionException: It was not possible to connect to the redis server(s); to create a disconnected multiplexer, disable AbortOnConnectFail. ConnectTimeout"
我已经阅读了将 abortconnect
设置为 false
并增加超时的解决方案,但我已经像上面的连接字符串一样实现了它。
如果您有任何建议或者您认为我们的连接字符串有问题,请提出建议。
更新:我们已经实现了解决连接问题的解决方案,但现在我们得到了这个:
StackExchange.Redis.RedisConnectionException: No connection is available to service this operation
最佳答案
您的 connectTimeout 设置为多少?您可以尝试增加它看看是否有帮助吗?
关于azure - 在 Azure 上托管的 .net Core 应用程序上连接到 Redis 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44250640/