【问题标题】:Can't connect to Azure Cache for Redis using SSL无法使用 SSL 连接到 Azure Cache for Redis
【发布时间】:2021-03-08 20:41:54
【问题描述】:

我正在尝试使用 StackExchange.Redis 从 asp.net MVC 应用程序连接到 Azure Cache For Redis 资源,并且它仅在我将端口设置为 6379 并且连接字符串中的 ssl=false 时才有效。

public class RedisCacheHelper
{
    static RedisCacheHelper()
    {
        lazyConnection = new Lazy<ConnectionMultiplexer>(() =>
        {
            return ConnectionMultiplexer.Connect(****.redis.cache.windows.net:6380,password=******=,ssl=True,abortConnect=False);
        });
    }

    private static Lazy<ConnectionMultiplexer> lazyConnection;

    public static ConnectionMultiplexer Connection
    {
        get
        {
            return lazyConnection?.Value;
        }
    }
}   

当我尝试使用 ssl=true 和我得到的 ssl 端口进行连接时:

“没有连接处于活动状态/可用于服务此操作:GET ******;阻塞操作被 WSACancelBlockingCall 调用中断,mc: 1/1/0, mgr: 10 of 10 available, clientName: DESKTOP-EMHQA7J,IOCP:(忙碌=0,空闲=1000,最小=12,最大=1000),工人: (忙=1,空闲=8190,最小=12,最大=8191),v:2.2.4.27433"}

这个文档说我应该有一个 .key 或 .pfx 文件,但我看不到我可以从 Azure 获取此类文件的位置。 https://docs.redislabs.com/latest/rs/references/client_references/client_csharp/

【问题讨论】:

    标签: stackexchange.redis azure-redis-cache


    【解决方案1】:

    您不需要.pfx.key 文件。

    你可以download my sample code,它对我有用。

    在本地,

    部署后,

    欲了解更多详情,请查看以下帖子。示例代码和你一样。

    Encrypting and decrypting values in Azure redis cache

    【讨论】:

      猜你喜欢
      • 2021-04-15
      • 2015-09-22
      • 2015-06-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-02-06
      • 2021-10-20
      • 1970-01-01
      相关资源
      最近更新 更多