Asp.net mvc 2 如何将的MVC配置文件配置为没有缓存

Asp.net mvc 2 如何将的MVC配置文件配置为没有缓存,asp.net-mvc-2,caching,Asp.net Mvc 2,Caching,我试图弄清楚如何将ASP.NET MVC2配置文件配置为完全没有缓存。我的当前配置文件具有此xml节点 <caching> <outputCacheSettings> <outputCacheProfiles> <add name="ZeroCacheProfile" duration="0" varyByParam="*" location="None" /> </outputCacheProfiles>

我试图弄清楚如何将ASP.NET MVC2配置文件配置为完全没有缓存。我的当前配置文件具有此xml节点

<caching>
  <outputCacheSettings>
    <outputCacheProfiles>
      <add name="ZeroCacheProfile" duration="0" varyByParam="*" location="None" />
    </outputCacheProfiles>
  </outputCacheSettings>
</caching>


这将向我表明,此应用程序没有缓存。我错过什么了吗?将继续浏览互联网,寻找最简洁的答案。谢谢。

在web.config中定义缓存配置文件本身除了定义缓存配置文件外,没有任何用处。必须有一些东西使用这个缓存配置文件,否则它将保持一个简单的定义。这就是工作的一半

第二部分是使用以下属性修饰所有要禁用缓存的控制器或操作:

[OutputCache(CacheProfile = "ZeroCacheProfile")]
或者,如果要对站点的所有控制器执行此操作,请定义一个所有控制器派生自的基本控制器,然后使用上述属性装饰此基本控制器