怎样才能在ASP.NET MVC中一个完整的trace.axd? [英] How can I generate a complete trace.axd in ASP.NET MVC?

查看:647
本文介绍了怎样才能在ASP.NET MVC中一个完整的trace.axd?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序,从而实现后 ASP.NET跟踪在 ASP.NET MVC应用程序,时间计算统计由5000倍都关闭。

On my application, after enabling ASP.NET Tracing in an ASP.NET MVC application, the time calculation statistics were off by a factor of 5000.

我有一个正在秒7和9之间加载页面。这是由双方的Firebug并在IIS日志文件时采取现场证实。 (这仅仅是返回到客户端,没有任何布局,DOM或脚本的执行的页面。)

I have a page that is taking between 7 and 9 seconds to load. This is corroborated by both Firebug and the "time-taken" field in the IIS log files. (This is just the page returning to the client, not any layout, DOM, or script execution.)

然而,当我打开应用程序范围内跟踪上(通过web.config中),并查看跟踪输出,所花费的时间开始preINIT到结束渲染小于0.001秒。

However, when I turn application-wide tracing on (via web.config) and view the trace output, the time taken from "Begin PreInit" to "End Render" is less than 0.001 seconds.

我想这是因为的trace.axd与心中的WebForms建成,MVC绕过传统的页面生命周期。

I assume this is because Trace.axd was built with WebForms in mind, and MVC bypasses the traditional page lifecycle.

然而,即使我在<一开始和结束添加自定义的痕迹href=\"http://msdn.microsoft.com/en-us/library/system.web.mvc.controller.onactionexecuting.aspx\">OnActionExecuting/OnActionExecuted,时间仍然小于0.1秒。

Yet even if I add custom traces at the start and end of OnActionExecuting/OnActionExecuted, the time is still less than 0.1 seconds.

有谁知道在ASP.NET MVC中,我将需要才能有输出的trace.axd准确报告执行时间挂钩?

Does anyone know where in ASP.NET MVC I will need to hook in order to have the trace.axd output report accurate execution times?

推荐答案

这可能是为操作方法本身的时间是不执行的重要组成部分。尝试检查OnResultExecuting / OnResultExecuted之间的时间。这基本上是实际呈现在HTML页面,而OnActionExecuting / OnActionExecuted是(基本上)建立数据视图的时间的时间。

It could be that the time for the action method itself is not the big part of the execution. Try checking the time between OnResultExecuting/OnResultExecuted. This is basically the time to actually render the page in HTML whereas OnActionExecuting/OnActionExecuted is (basically) the time to set up the data for the view.

请注意,如果你正在使用LINQ,数据查询本身可能会被推迟,直到页面呈现(所列的型号)。即,慢度可能不是由于即使当时间被取入执行结果页面复杂性,但数据的访问。

Note that if you are using LINQ, the data queries themselves may be deferred until the page is rendered (the model enumerated). That is, the slowness may not be due to page complexity but data access even when the time is taken in executing the result.

这篇关于怎样才能在ASP.NET MVC中一个完整的trace.axd?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆