Azure Redis无法连接到Redis服务器

我正在使用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; } } 

我有完全相同的例外,它原来是企业防火墙,它阻止端口6379,6380。

我在公司网络外的环境中复制了我的测试控制台应用程序并且连接成功。 因此,如果Redis服务器在Internet上运行且您的网络位于防火墙后面,请确保端口已打开。