Asp.net mvc Redis的ASP.NET输出缓存提供程序不';t商店

Asp.net mvc Redis的ASP.NET输出缓存提供程序不';t商店,asp.net-mvc,redis,outputcache,Asp.net Mvc,Redis,Outputcache,我不知道如何排除故障,但我正在尝试通过Redis输出缓存提供程序实现ASP.NET输出缓存 我们已经设置了Redis服务器(非azure),我可以存储缓存以供一般使用。 但是,当我尝试设置ASP.NET输出缓存时,它似乎没有将任何内容保存到缓存中 我已通过Nuget安装了Microsoft.Web.RedisOutputCacheProvider。 Web.Config的设置如下所示: <caching> <outputCache defaultProvider="

我不知道如何排除故障,但我正在尝试通过Redis输出缓存提供程序实现ASP.NET输出缓存

我们已经设置了Redis服务器(非azure),我可以存储缓存以供一般使用。 但是,当我尝试设置ASP.NET输出缓存时,它似乎没有将任何内容保存到缓存中

我已通过Nuget安装了Microsoft.Web.RedisOutputCacheProvider。 Web.Config的设置如下所示:

<caching>
      <outputCache defaultProvider="MyRedisOutputCache">
        <providers>
          <add name="MyRedisOutputCache" type="Microsoft.Web.Redis.RedisOutputCacheProvider" host="ServerName" port="6464" accessKey="PasswordToRedis" />
        </providers>
      </outputCache>
</caching>
当我检查Redis时,我没有看到任何OutputCache被存储


我错过什么了吗?有没有办法调试它为什么不在缓存中存储任何东西?

好的,这真是太傻了

当您通过Nuget安装RedisOutputCacheProvider时,您将在app/web.config中获得以下小文档:

<!-- For more details check https://github.com/Azure/aspnet-redis-providers/wiki --><!-- Either use 'connectionString' OR 'settingsClassName' and 'settingsMethodName' OR use 'host','port','accessKey','ssl','connectionTimeoutInMilliseconds' and 'operationTimeoutInMilliseconds'. --><!-- 'databaseId' and 'applicationName' can be used with both options. --><!--
          <add name="MyRedisOutputCache" 
            host = "127.0.0.1" [String]
            port = "" [number]
            accessKey = "" [String]
            ssl = "false" [true|false]
            databaseId = "0" [number]
            applicationName = "" [String]
            connectionTimeoutInMilliseconds = "5000" [number]
            operationTimeoutInMilliseconds = "1000" [number]
            connectionString = "<Valid StackExchange.Redis connection string>" [String]
            settingsClassName = "<Assembly qualified class name that contains settings method specified below. Which basically return 'connectionString' value>" [String]
            settingsMethodName = "<Settings method should be defined in settingsClass. It should be public, static, does not take any parameters and should have a return type of 'String', which is basically 'connectionString' value.>" [String]
            loggingClassName = "<Assembly qualified class name that contains logging method specified below>" [String]
            loggingMethodName = "<Logging method should be defined in loggingClass. It should be public, static, does not take any parameters and should have a return type of System.IO.TextWriter.>" [String]
            redisSerializerType = "<Assembly qualified class name that implements Microsoft.Web.Redis.ISerializer>" [String]
          />

我在本地主机上工作,没有SSL设置。在生产中我需要它,但在我的产品中它是connectionstring的一部分(我是由我的Redis托管服务提供的)

它无法工作并且您必须将RedisOutputCacheProvider降级到1.7.5的原因是因为您正在使用Exchange.Redis.Strongname.dll(版本1.2.6)

根据这个问题,Redis不再需要强名称,因为基础版本现在是强名称。


因此,要使用RedisOutputCacheProvider v3.0.144,您需要卸载Exchange.Redis.Strongname.dll(版本1.2.6)并通过Nuget安装Exchange.Redis.dll(版本2.0.601)

检查一下,缓存PING命令是否在您的web应用程序中工作?我应该指出,应用程序或缓存服务器都不在Azure上。没有。除此之外,我能够使用代码中的普通缓存方法使用Redis缓存。但是,如果我选择使用OutputCacheProvider进行输出缓存,我不会存储任何内容。您可以尝试根据本文更改您的web.config吗?我在类型上使用了额外的参数进行了尝试,但它仍然不起作用。没有错误。
<!-- For more details check https://github.com/Azure/aspnet-redis-providers/wiki --><!-- Either use 'connectionString' OR 'settingsClassName' and 'settingsMethodName' OR use 'host','port','accessKey','ssl','connectionTimeoutInMilliseconds' and 'operationTimeoutInMilliseconds'. --><!-- 'databaseId' and 'applicationName' can be used with both options. --><!--
          <add name="MyRedisOutputCache" 
            host = "127.0.0.1" [String]
            port = "" [number]
            accessKey = "" [String]
            ssl = "false" [true|false]
            databaseId = "0" [number]
            applicationName = "" [String]
            connectionTimeoutInMilliseconds = "5000" [number]
            operationTimeoutInMilliseconds = "1000" [number]
            connectionString = "<Valid StackExchange.Redis connection string>" [String]
            settingsClassName = "<Assembly qualified class name that contains settings method specified below. Which basically return 'connectionString' value>" [String]
            settingsMethodName = "<Settings method should be defined in settingsClass. It should be public, static, does not take any parameters and should have a return type of 'String', which is basically 'connectionString' value.>" [String]
            loggingClassName = "<Assembly qualified class name that contains logging method specified below>" [String]
            loggingMethodName = "<Logging method should be defined in loggingClass. It should be public, static, does not take any parameters and should have a return type of System.IO.TextWriter.>" [String]
            redisSerializerType = "<Assembly qualified class name that implements Microsoft.Web.Redis.ISerializer>" [String]
          />