我运行一个测试应用程序,它以下列方式连接到Redis服务器:
var options = new ConfigurationOptions();
options.AbortOnConnectFail = false;
options.EndPoints.Add(Settings.HostName + ":" + Settings.Port);
Connection = ConnectionMultiplexer.Connect(options);
Connection.ConnectionFailed += (sender, args) => SystemMessageCallback(new SystemMessage(SystemMessageType.Error, "Connection to Redis Server failed: " + args.Exception.Message));
Connection.ConnectionRestored += (sender, args) => SystemMessageCallback(new SystemMessage(SystemMessageType.Error, "Connection to Redis Server restored: " + args.Exception.Message));
if (!IsConnected())
{
SystemMessageCallback(new SystemMessage(SystemMessageType.Error, "Connection to Redis Server failed"));
}
当我现在关闭服务器(当我的客户端仍在运行时)时,我收到以下错误消息:
与Redis服务器的连接失败:SocketFailure on 127.0.0.1:6379/Interactive,input-buffer:0,outstanding:0,last-read:9s ago,last-write:9s ago,keep-alive:-1s,pending:0, state:ConnectedEstablished,last-heartbeat:0s ago,last-mbeat:0s 之前,全球:0年前
一切按预期进行(我无法评论上面的确切错误消息内容,因为它来自StackExchange.Redis)但是当我重新启动服务器时,客户端不再从服务器关闭恢复,回调不是在Connection.ConnectionRestored
上调用。我做错了什么吗?
我的C#客户端是StackExchange.Redis版本1.0.242.0(v4.0.30319),我运行MS Open Tech Group的2.8.4版本,但我怀疑错误源自StackExchange.Redis。