When I measure request times on "the inside" of an Asp.Net application and compare it to timings on "the outside" of the app, I get different values -- 1000-5000ms strange overheads from time to time.
当我在Asp.Net应用程序的“内部”测量请求时间并将其与应用程序的“外部”的时间进行比较时,我会得到不同的值 - 不时有1000-5000毫秒的奇怪开销。
Maybe the requests are beeing queued up in front of IIS?
也许这些请求在IIS前排队?
Or something strange is going on in an HttpModule?
或者在HttpModule中发生了什么奇怪的事情?
The question: Is there a way to inspect the request pipeline for tracing exactly where the time is spent before the app is hit?
问题:有没有办法检查请求管道,以便在应用程序被命中之前准确跟踪时间花在哪里?
4 个解决方案
#1
1
You can create your own module and register it on top to trace every request with more accuracy, but the measure will start once the IIS delegates the request to the ASP.NET ISAPI module. To get more accuracy you can go to IIS logs.
您可以创建自己的模块并在顶部注册以更准确地跟踪每个请求,但是一旦IIS将请求委托给ASP.NET ISAPI模块,该测量将开始。要获得更高的准确性,您可以转到IIS日志。
#2
2
As Dan said, you need enable tracing at the application level (web.config):
正如Dan所说,您需要在应用程序级别启用跟踪(web.config):
<!-- pageOutput enables trace output from the page itself -->
<system.web>
<trace enable="true" pageOutput="true" traceMode="SortByTime"/>
</system.web>
Or you can enable tracing at the page level. This can be done by setting the trace = "true" in Page directive.
或者您可以在页面级别启用跟踪。这可以通过在Page指令中设置trace =“true”来完成。
<%@ Page Language="C#" Trace="true"
Inherits="System.Web.UI.Page" CodeFile="Default.aspx.cs" %>
The application level tracing can be viewed from http://localhost/appname/trace.axd. This will show list of requests:
可以从http://localhost/appname/trace.axd查看应用程序级别跟踪。这将显示请求列表:
http://www.brainbell.com/tutorials/ASP/images/F18GU01.png
When you click on details of each page you can see how much time each event in the life cycle of the page took. This should help you to figure out where exactly your page is taking more than expected time.
当您单击每个页面的详细信息时,您可以看到页面生命周期中每个事件花费的时间。这可以帮助您确定您的网页所占用的时间超过预期时间。
[Image referenced from http://www.brainbell.com/tutorials/ASP/Built-in_Handlers.html]
[图片来自http://www.brainbell.com/tutorials/ASP/Built-in_Handlers.html]
#3
0
You can turn on tracing in your web.config file. The line should say something like <trace enabled="true" pageOutput="true" />
. The MSDN page is here.
您可以在web.config文件中打开跟踪。该行应该说类似
#4
0
You want to also try out Glimpse. It allows you to see Modules in the request pipeline as well as a host of other information.
你想试试Glimpse。它允许您查看请求管道中的模块以及许多其他信息。
#1
1
You can create your own module and register it on top to trace every request with more accuracy, but the measure will start once the IIS delegates the request to the ASP.NET ISAPI module. To get more accuracy you can go to IIS logs.
您可以创建自己的模块并在顶部注册以更准确地跟踪每个请求,但是一旦IIS将请求委托给ASP.NET ISAPI模块,该测量将开始。要获得更高的准确性,您可以转到IIS日志。
#2
2
As Dan said, you need enable tracing at the application level (web.config):
正如Dan所说,您需要在应用程序级别启用跟踪(web.config):
<!-- pageOutput enables trace output from the page itself -->
<system.web>
<trace enable="true" pageOutput="true" traceMode="SortByTime"/>
</system.web>
Or you can enable tracing at the page level. This can be done by setting the trace = "true" in Page directive.
或者您可以在页面级别启用跟踪。这可以通过在Page指令中设置trace =“true”来完成。
<%@ Page Language="C#" Trace="true"
Inherits="System.Web.UI.Page" CodeFile="Default.aspx.cs" %>
The application level tracing can be viewed from http://localhost/appname/trace.axd. This will show list of requests:
可以从http://localhost/appname/trace.axd查看应用程序级别跟踪。这将显示请求列表:
http://www.brainbell.com/tutorials/ASP/images/F18GU01.png
When you click on details of each page you can see how much time each event in the life cycle of the page took. This should help you to figure out where exactly your page is taking more than expected time.
当您单击每个页面的详细信息时,您可以看到页面生命周期中每个事件花费的时间。这可以帮助您确定您的网页所占用的时间超过预期时间。
[Image referenced from http://www.brainbell.com/tutorials/ASP/Built-in_Handlers.html]
[图片来自http://www.brainbell.com/tutorials/ASP/Built-in_Handlers.html]
#3
0
You can turn on tracing in your web.config file. The line should say something like <trace enabled="true" pageOutput="true" />
. The MSDN page is here.
您可以在web.config文件中打开跟踪。该行应该说类似
#4
0
You want to also try out Glimpse. It allows you to see Modules in the request pipeline as well as a host of other information.
你想试试Glimpse。它允许您查看请求管道中的模块以及许多其他信息。