我在测试站点上使用 mvc-mini-profiler。当我在我的操作方法上放置一个 OutputCacheAttribute 时,分析器不会被执行并且总是返回他在缓存之前的最后一个值。
有没有办法告诉 mvc-mini-profiler 结果来自缓存,以便它可以更新他的状态?也许在客户端,我们可以看到这样的信息:
http://localhost/Home (from cache) 2.1ms, +0.5ms
最佳答案
将输出缓存应用于 Controller 操作也会缓存分析器结果。当 OutputCache 应用于 Controller 时,大部分 ASP.NET MVC 管道都不会执行。
您可以将页面生成时间的日期时间信息添加到分析器中,例如:
profiler.Step("Generated: " + DateTime.Now.ToString());
关于asp.net-mvc-3 - 带有 OutputCacheAttribute 的 mvc-mini-profiler,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6823626/