3

MVC Web プロジェクトがあり、ローカルで実行されている redis キャッシュを使用して一部のページに OutputCache をセットアップしようとしています。最終的には Azure でホストされます。

ActionResultを装飾しました

[OutputCache(CacheProfile = "cacheprofile1")]

system.web / caching の下の web.config に次のものがあります

  <outputCacheSettings>
    <outputCacheProfiles>
      <add name="cacheprofile1" duration="1800" varyByParam="none"/>
    </outputCacheProfiles>
  </outputCacheSettings>

私のキャッシュプロバイダーはそれに応じて設定されています

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

キャッシュにエントリが作成されていません。ActionResult の装飾を

[OutputCache(Duration=1800)]

それは機能しますが、各メソッドに対してこれを手動で設定する必要はありません。

キャッシュ プロファイルが無視される理由と解決方法についてのアイデアをいただければ幸いです。

4

0 に答える 0