Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ProviderException when using a custom output cache provider RedisOutputCacheProvider

I have installed the nuget package Microsoft.Web.RedisOutputCacheProvider for use with Azure Web App running on multiple server instances following the instructions here https://msdn.microsoft.com/en-us/library/azure/dn798898.aspx and are receiving the following error:

When using a custom output cache provider like 'MyRedisOutputCache', only the following expiration policies and cache features are supported:  file dependencies, absolute expirations, static validation callbacks and static substitution callbacks.

The configuration setting is as follows:

<system.web>
  <caching>
    <outputCache defaultProvider="MyRedisOutputCache">
      <providers>
        <add name="MyRedisOutputCache" 
             type="Microsoft.Web.Redis.RedisOutputCacheProvider" 
             port="1234" 
             host="[my host]" 
             accessKey="[my access key]" 
             ssl="true" />
      </providers>
    </outputCache>
  </caching>
</system.web>

I've tried setting the connectionString to a valid StackExchange.Redis connection string instead of setting the individual port/host etc... but still receive the same error.

We also have the Microsoft.Web.RedisSessionStateProvider running in the same web app using the same settings with no issues.

Any help would be appreciated.

like image 684
robmzd Avatar asked Sep 26 '22 22:09

robmzd


1 Answers

Using the RedisOutputCacheProvider with secured controller actions which employ some flavor of the AuthorizeAttribute appear to be causing the exception. It works fine for AllowAnonymous actions. The below may help:

Why can't I combine [Authorize] and [OutputCache] attributes when using Azure cache (.NET MVC3 app)?

like image 90
Bill Christenson Avatar answered Nov 15 '22 10:11

Bill Christenson