我正在使用StackExchange.Redis.StrongName 1.0.394
,并尝试连接到我的Azure Redis,但当我运行我的项目时,一直出现以下错误:
RedisConnectionException: It was not possible to connect to the redis server(s);
to create a disconnected multiplexer, disable AbortOnConnectFail. SocketFailure on PING
奇怪的是,如果我使用 StackExchange.Redis 1.0.394
,一切都能正常工作,但是我需要 StrongName 版本才能使用 RedisSessionStateProvider。
以下是连接到 Redis 的代码:
private static ConnectionMultiplexer Connection
{
get
{
if (_connection == null || !_connection.IsConnected)
{
var config = new ConfigurationOptions();
config.EndPoints.Add("myredisname.redis.cache.windows.net");
config.Password = "myverylongkey";
//in ms
config.SyncTimeout = 5000;
config.Ssl = true;
config.AbortOnConnectFail = false;
_connection = ConnectionMultiplexer.Connect(config);
}
return _connection;
}
}