asp.net-mvc-3 - 带有 OutputCacheAttribute 的 mvc-mini-profiler

标签 asp.net-mvc-3 outputcache mvc-mini-profiler

我在测试站点上使用 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/

相关文章:

asp.net-mvc-3 - 获取行中的第一个和第二个 td 元素

c# - 在 ASP.NET MVC 3 View 层次结构之间传递的数据

asp.net-mvc - 我的 View 模型值类型属性应该可以为空吗?

asp.net-mvc-3 - 你如何在 Rackspace 云站点中使用 [RequireHttps]

asp.net - 在 ASP.NET 网页/WebMatrix 项目中启用输出缓存

mvc-mini-profiler - 我们在v1.9中获得 "a.tmpl.complete is not a function"

jquery - Mvc Mini Profiler + ASP.NET PageMethods 未更新

c# - URL重写+输出缓存

asp.net - 如何在 GetVaryByCustomString 中访问 asp.net mvc 路由值?

asp.net-mvc-3 - Mini Profiler 不渲染脚本