在ASP.NET MVC 5中使用远程Redis配置OutputCache

时间:2017-02-07 09:30:24

标签: asp.net-mvc azure caching redis outputcache

我尝试连接到我的OutputCache的Redis,我已经在web.config中配置了这个(对于localhost,一切正常)

<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>

我已阅读this article并测试了所有可能性,但没有结果。我没有异常,解决方案编译正确。

我失踪了什么?

谢谢!

1 个答案:

答案 0 :(得分:1)

尝试在web.config中指定databaseId字段,请检查以下链接并告诉我https://www.captechconsulting.com/blogs/azure-redis-cache