【发布时间】:2019-07-01 16:07:04
【问题描述】:
我的控制器动作用 OutputCache 属性修饰:
[OutputCache(Duration = 60 * 60 * 12, VaryByParam = "*")]
public ActionResult GetProducts(int id, string template, string version)
我想在调试模式下禁用它,所以我使用了 web.config 转换,所以在调试模式下我得到了这些额外的行:
<caching>
<outputCache enableOutputCache="false" enableFragmentCache="false" />
</caching>
但是缓存仍然有效 - 动作结果被缓存,在视图中更改代码在渲染时无效。
有什么想法吗?
IT 人
【问题讨论】:
-
将
[OutputCache]属性包装在#if !DEBUG语句中
标签: c# asp.net-mvc