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.
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.)
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.
I assume this is because Trace.axd was built with WebForms in mind, and MVC bypasses the traditional page lifecycle.
Yet even if I add custom traces at the start and end of OnActionExecuting/OnActionExecuted, the time is still less than 0.1 seconds.
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?
Trace Configuration Attributes The default is false. You can override this setting for individual pages by setting the Trace attribute in the @ Page directive of a page to true or false. true to display trace both in pages and in the trace viewer (Trace. axd); otherwise, false.
The Trace. axd application keeps a very detailed log of all requests made to an application over a period of time. This information includes remote client IP's, session IDs, all request and response cookies, physical paths, source code information, and potentially even usernames and passwords.
When we enable application level tracing, trace information is gathered and processed for each page in that application. We can enable application level tracing by using the trace element in the Web. config file. By default, application level tracing can be viewed only on the local Web server computer.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With