Azure Redis unable to connect to Redis servers

匿名 (未验证) 提交于 2019-12-03 00:56:02

问题:

I'm using StackExchange.Redis.StrongName 1.0.394 And I'm trying to connect to my Azure Redis, but I keep getting this error when I run my project:

RedisConnectionException: It was not possible to connect to the redis server(s);  to create a disconnected multiplexer, disable AbortOnConnectFail. SocketFailure on PING 

Oddly enough, if I use StackExchange.Redis 1.0.394 everything works fine, but I need StrongName version in order to use RedisSessionStateProvider.

Here is code for connecting to 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;         }     } 

回答1:

I had exact same exception and it turned out to be corporate firewall, which is blocking port 6379, 6380.

I copied my test console app in an environment outside company network and connection was successful. So if Redis server is running on the internet and your network is behind a firewall make sure the ports are open.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!