在 ASP.NET MVC 5 中使用远程 Redis 配置输出缓存



我正在尝试为我的输出缓存连接到 Redis,我已经在 web.config 中配置了它(对于本地主机,一切正常(

<system.web>
    <caching>
      <outputCache defaultProvider="localRedisOutputCache">
        <providers>
          <add name="localRedisOutputCache" type="Microsoft.Web.Redis.RedisOutputCacheProvider" host="127.0.0.1" accessKey="" ssl="false" />          
        </providers>
      </outputCache>
    </caching>
</system.web>

但是当我更改为我的 Azure Redis 时,它不起作用......

<system.web>
    <caching>
      <outputCache defaultProvider="remoteRedisOutputCache">
        <providers>
          <add name="remoteRedisOutputCache" type="Microsoft.Web.Redis.RedisOutputCacheProvider" host="{{myName}}.redis.cache.windows.net" accessKey="{{MyAccessKey}}" ssl="true" />
      </outputCache>
    </caching>
</system.web>

我已经阅读了这篇文章并测试了所有可能性,但没有结果。我没有例外,解决方案编译正确。

我错过了什么?

谢谢!

尝试在您的

web.config 中指定 databaseId 字段,请检查以下链接并让我知道 https://www.captechconsulting.com/blogs/azure-redis-cache

最新更新