使用 Azure Redis 数据库配置 RedisOutputCacheProvider

Configure RedisOutputCacheProvider with Azure Redis DB

拥有网络应用程序项目(网络表单)和 Azure 订阅。从 Nuget 安装包 RedisOutputCacheProvider。

使用建议的配置:

<caching>
      <outputCache defaultProvider="MyRedisOutputCache">
        <providers>
          <!-- Either use 'connectionString' and provide all parameters as string OR use 'host','port','accessKey','ssl','connectionTimeoutInMilliseconds' and 'operationTimeoutInMilliseconds'. -->
          <!-- 'databaseId' and 'applicationName' can be used with both options. -->
          <add name="MyRedisOutputCache" type="Microsoft.Web.Redis.RedisOutputCacheProvider"
               host="myhost.redis.cache.windows.net"
               port="6380"
               accessKey="myKey"
               ssl="true"
               connectionTimeoutInMilliseconds = "5000"
               operationTimeoutInMilliseconds = "1000"
               />

        </providers>
      </outputCache>
    </caching>

应用程序启动时出现永久性错误:无法加载类型 'Microsoft.Web.Redis.RedisOutputCacheProvider'。

已解决。 Microsoft.Web.Redis.RedisOutputCacheProvider 和 StackExchange.Redis.StrongName 库的版本之间存在冲突。