我完全厌倦了具有功能的Azure Redis缓存。
在控制台应用程序中工作的“测试代码”下面一行,但在Azure函数中不工作。
IConnectionMultiplexer connection = ConnectionMultiplexer.Connect("**********rediscache.redis.cache.windows.net:6380,password=nFpm1oIiyP8ZiCxC/WMcxaFRzGo4yMgWDYZksQgqO4U=,ssl=True,abortConnect=False");
IDatabase database = connection.GetDatabase();
bool isConnected = connection.IsConnected;
var test = database.HashExists("key", "fieldKey");
database.HashSet("key", "fieldKey", "test");
database.StringSet("Key", "Value");
var result = database.StringGet("Key");
connection.Close();
使用Visual Studio中的Azure函数
Nuget-StackExchange.Redis 2.0.505和Microsoft.NET.Sdk.Functions 1.0.22
Exception while executing function: Function1. StackExchange.Redis:
No connection is available to service this operation: HEXISTS key;
UnableToConnect on
catamsrediscache.redis.cache.windows.net:6380/Interactive,
Flushed, last: ECHO, origin: ResetNonConnected, outstanding: 9, last-read:
5s ago, last-write: 0s ago, unanswered-write: 0s ago, keep-alive: 60s,
state: ConnectedEstablishing, mgr: 10 of 10 available, last-heartbeat:
never, global:
0s ago, v: 2.0.505.18761; IOCP: (Busy=0,Free=1000,Min=4,Max=1000), WORKER:
(Busy=2,Free=1021,Min=4,Max=1023), Local-CPU: n/a. UnableToConnect on
catamsrediscache.redis.cache.windows.net:6380/Interactive, Flushed, last:
ECHO, origin: ResetNonConnected, outstanding: 9, last-read: 5s ago,
last-write: 0s ago, unanswered-write: 0s ago, keep-alive: 60s, state:
ConnectedEstablishing, mgr: 10 of 10 available, last-heartbeat: never,
global: 0s ago, v: 2.0.505.18761.
任何人都知道为什么此错误仅在函数中出现吗?
答案 0 :(得分:2)
这看上去与StackExchange.Redis GitHub页面上的this reported issue几乎相同。我建议您在此跟踪您的错误详细信息,以帮助他们诊断您遇到的问题。
答案 1 :(得分:0)
我遇到了相同的错误,必须将StackExchange.Redis
Nuget软件包更新为1.2.6。
现在问题已通过 StackExchange.Redis 2.0.519
解决