在X秒内呈现的页面? [英] Page rendered in X seconds?

查看:50
本文介绍了在X秒内呈现的页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想在我的所有页面上显示一条谨慎的消息,表明服务器渲染页面的时间长度为
。完全跟踪不是一个选项

,因为它会吓坏我的非技术用户!

我在网上看了一下,却找不到任何可以做到这一点,或者在SDK

docs。我认为.Net 2.0会为这个

类型的性能测量提供更多开箱即用的东西,但是我找不到任何东西。


i正在考虑使用Application_BeginRequest运行一个计时器和

EndRequest但是这似乎有点粗糙,因为一部分请求

将无法将其响应流写入,例如for

下载二进制文件等。

另一种方法是在Page_PreInit中启动一个计时器,然后在Page_PreRender结束计时器

,写出来但这是因为卸载方法没有延迟任何

,这是否可以忽略?


提前感谢

tim


i would like to display a discreet message on all my pages indicating how
long the server took to render the page. full tracing is not an option
because it would freak out my non-technical users!
i''ve looked around online and can find nothing to do this, or in the SDK
docs. i thought .Net 2.0 would have something more out-of-the-box for this
type of performance measuring but i can''t find any.

i was thinking about running a timer with Application_BeginRequest and
EndRequest but that seems a little crude given that a portion of requests
will not be able to have their response stream written to, e.g. for
downloading binary files etc.
another approach is to start a timer in Page_PreInit and then end the timer
in Page_PreRender, writing it out to a label etc. But this is missing any
delay from the Unload method, is this negligable?

thanks in advance
tim

推荐答案

PreInit / PreRender是你最好的选择...你会错过Unload,但你会

也有,因为在那时写入页面已经太晚了...你是在谈论毫秒......这是...(除非你是...)做一些疯狂的东西

在那里,但我的猜测是你什么都没做。


Karl

-
http://www.openmymind.net/
http://www.codebetter.com/

Ti m_Mac" < ti ******** @ community.nospamwrote in message

news:uU ************** @ TK2MSFTNGP05.phx.gbl .. 。
PreInit/PreRender is ur best bet...you''ll miss out on Unload, but you''ll
have too since it''s too late to write to the page at that point...You''re
talking about millisenconds..if that..(unless you are doing some crazy stuff
in there, but my guess is that you aren''t doing anything at all).

Karl
--
http://www.openmymind.net/
http://www.codebetter.com/
"Tim_Mac" <ti********@community.nospamwrote in message
news:uU**************@TK2MSFTNGP05.phx.gbl...



i想在我的所有页面上显示一条谨慎的信息,表明

多长服务器用于呈现页面。完全跟踪不是一个选项

,因为它会吓坏我的非技术用户!

我在网上看了一下,却找不到任何可以做到这一点,或者在SDK

docs。我认为.Net 2.0会有更多开箱即用的功能,这种类型的性能测量但是我找不到任何东西。


i正在考虑使用Application_BeginRequest运行一个计时器和

EndRequest但是这似乎有点粗糙,因为一部分请求

将无法将其响应流写入,例如for

下载二进制文件等。

另一种方法是在Page_PreInit中启动一个计时器,然后结束Page_PreRender中的

计时器,写出来但这是

缺少卸载方法的任何延迟,这是否可以忽略?


提前感谢

tim

i would like to display a discreet message on all my pages indicating how
long the server took to render the page. full tracing is not an option
because it would freak out my non-technical users!
i''ve looked around online and can find nothing to do this, or in the SDK
docs. i thought .Net 2.0 would have something more out-of-the-box for
this type of performance measuring but i can''t find any.

i was thinking about running a timer with Application_BeginRequest and
EndRequest but that seems a little crude given that a portion of requests
will not be able to have their response stream written to, e.g. for
downloading binary files etc.
another approach is to start a timer in Page_PreInit and then end the
timer in Page_PreRender, writing it out to a label etc. But this is
missing any delay from the Unload method, is this negligable?

thanks in advance
tim



感谢卡尔的意见。


你好蒂姆,


至于b $ b表示服务器渲染页面所花费的时间你提到
,你的意思是ASP.NET页面处理页面'

请求的时间(加载发布数据,处理回发事件......)或者

运行时将页面呈现为响应流的时间?


如果您想要的是获取时间服务器处理程序进程页面请求,我将/>
认为可以使用PreInit和PreRender事件对进行

计算,因为当时所有主要处理都已完成。

And至于UnLoad事件,你不需要担心它,因为

卸载是在页面实例的处置时调用的,这不是保证

是在页面渲染后立即进行,因此卸载时的延迟不应该反映在页面请求的处理时间内。


此外, PreInit / PreRender对可以获得最多的页面请求

处理时间,如果你想处理完整的时间,最好的选择

应该使用自定义的httpmodule并使用HttpApplication管道

事件来计算时间。 PreRequestHandlerExecute和

" PostRequestHandlerExecute"

页面处理程序处理请求之前和之后触发的事件。


#ASP.NET应用程序生命周期概述
http://msdn2.microsoft.com/en-us/library/ms178473 .aspx

http: //support.microsoft.com/kb/307985/en-us


我们无法访问页面结构中的控件,如页面的代码,

但只能将内容写入当前请求的响应流。

请如果您有任何其他的考虑或想法,请随时在此发布。


此致,


Steven Cheng


Microsoft MSDN在线支持主管


============================= =====================


通过电子邮件收到我的帖子通知?请参阅
http://msdn.microsoft .com / subscripti ... ult.aspx#notif

ications。


注意:MSDN托管新闻组支持服务是针对非紧急问题

如果社区或微软支持人员在1个工作日内做出初步回复是可以接受的。请注意,每个跟随

的响应可能需要大约2个工作日作为支持

专业人士与您合作可能需要进一步调查才能达到

最有效的分辨率。该产品不适用于需要紧急,实时或基于电话的交互或复杂的b $ b项目分析和转储分析问题的情况。这种性质的问题最好通过联系

Microsoft客户支持服务(CSS)处理
href =http://msdn.microsoft.com/subscriptions/support/default.aspx\"target =_ blank> http://msdn.microsoft.com/subscripti...t/default.aspx


==================================== ==============


此帖子按原样提供。没有保证,也没有授予任何权利。

Thanks for Karl''s input.

Hi Tim,

As for the " indicating how long the server took to render the page" you
mentioned, do you mean the time the ASP.NET page hander process the page''s
request (load post data , handle postback events....) or the time the
runtime render out the page into response stream?

If what you want is get the time server handler process page request, I
think it ok to use the PreInit and PreRender event pair to do the
calculation since at that time all the main processing has been finished.
And as for the UnLoad event, you do not need to worry about it, because
Unload is called at the page instance''s dispose time which is not guarantee
to be immediately after page''s rendering, so the delay in Unload should not
be countered into page request''s processing time.

In addition, though PreInit/PreRender pair can get the most page request
processing time, if you want to handle the complete time, the best choice
should be use a custom httpmodule and use the HttpApplication pipeline
events to caculate the time. The "PreRequestHandlerExecute" and
"PostRequestHandlerExecute" events are the ones that fires before and after
page handler process the request.

#ASP.NET Application Life Cycle Overview
http://msdn2.microsoft.com/en-us/library/ms178473.aspx

http://support.microsoft.com/kb/307985/en-us

However, the limitation of using custom httphandler and pipeline event is
that we can not access the control in page structure like in Page''s code,
but can only write content into current request''s response stream.
Please feel free to post here if you have any other consideration or ideas.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.


嗨史蒂文,

感谢您的回答。到目前为止,我已经尝试了preinit和

preRender事件对,它似乎提供了一个很好的指示。我喜欢

直接写入页面控件的能力,而不是试图通过HttpHandler在文档的正确位置注入一些HTML。
<有些用户偶尔会抱怨我的网络应用程序运行缓慢,但我99.99%肯定问题是他们自己的公司

LAN,共享一个宽带连接。很难保持

重新向他们保证我的应用程序没有任何问题,所以希望我可以使用

这个加载时间指示器来帮助他们查看是否存在问题实际上是服务器或他们自己的连接




我确信应用程序写得很好并且表现非常好

响应所有的时间,所以我希望这会让用户离开

我独自一人:)


非常感谢再次

tim


Steven Cheng [MSFT]" < st ***** @ online.microsoft.com写信息

新闻:9p ************** @ TK2MSFTNGXA01.phx.gbl ...
hi Steven,
thanks for your answer. i have tried it out so far with the preinit and
preRender event pair and it seems to provide a good indication. i like the
ability to write directly to page controls, rather than trying to inject
some HTML at the right point in the document via a HttpHandler.

i have some users who occassionally complain that my web application is
running slow, but i am 99.99% sure that the problem is their own company
LAN, which shares a single broadband connection. it is difficult to keep
re-assuring them that nothing is wrong with my app, so hopefully i can use
this load-time indicator to help them see if the problem is actually with
the server or their own connection.

i''m confident that the application is well written and performing very
responsively all the time, so i''m hopeful this will get the users to leave
me alone :)

many thanks again
tim

"Steven Cheng[MSFT]" <st*****@online.microsoft.comwrote in message
news:9p**************@TK2MSFTNGXA01.phx.gbl...

感谢Karl的投入。


你好蒂姆,


至于表示服务器渲染页面所花费的时间你提到
,你的意思是ASP.NET页面处理页面'

请求的时间(加载发布数据,处理回发事件......)或者

运行时将页面呈现为响应流的时间?


如果您想要的是获取时间服务器处理程序进程页面请求,我将/>
认为可以使用PreInit和PreRender事件对进行

计算,因为当时所有主要处理都已完成。

And至于UnLoad事件,你不需要担心它,因为

卸载是在页面实例的处置时间调用的,这不是

保证

在页面渲染后立即显示,因此卸载时的延迟应该是

而不是
被反击到页面请求的处理时间。


另外,虽然PreInit / PreRender对可以获得最多的页面请求

处理时间,如果你想处理完整的时间,最好的选择

应该使用自定义的httpmodule并使用HttpApplication管道

事件来计算时间。 PreRequestHandlerExecute和

" PostRequestHandlerExecute"

页面处理程序处理请求后,事件是之前触发的事件和




#ASP.NET应用程序生命周期概述
http://msdn2.microsoft.com /en-us/library/ms178473.aspx

http://support.microsoft.com/kb/307985/en-us


但是,使用自定义httphandler和管道事件的限制是
,我们无法像页面代码那样访问页面结构中的控件,

但是只能将内容写入当前请求的响应流。


如果您有任何其他考虑或

想法,请随时在此发布。


此致,


Steven Cheng


Microsoft MSDN在线支持主管


========= ========================= ================


通过电子邮件收到我的帖子通知?请参阅
http://msdn.microsoft .com / subscripti ... ult.aspx#notif

ications。


注意:MSDN托管新闻组支持服务是针对非紧急问题

如果社区或微软支持人员在1个工作日内做出初步回复是可以接受的。请注意,每个跟随

的响应可能需要大约2个工作日作为支持

专业人士与您合作可能需要进一步调查才能达到

最有效的分辨率。该产品不适用于需要紧急,实时或基于电话的交互或复杂的b $ b项目分析和转储分析问题的情况。这种性质的问题最好通过联系

Microsoft客户支持服务(CSS)处理
href =http://msdn.microsoft.com/subscriptions/support/default.aspx\"target =_ blank> http://msdn.microsoft.com/subscripti...t/default.aspx


==================================== ==============


此帖子按原样提供。没有保证,也没有赋予

权利。
Thanks for Karl''s input.

Hi Tim,

As for the " indicating how long the server took to render the page" you
mentioned, do you mean the time the ASP.NET page hander process the page''s
request (load post data , handle postback events....) or the time the
runtime render out the page into response stream?

If what you want is get the time server handler process page request, I
think it ok to use the PreInit and PreRender event pair to do the
calculation since at that time all the main processing has been finished.
And as for the UnLoad event, you do not need to worry about it, because
Unload is called at the page instance''s dispose time which is not
guarantee
to be immediately after page''s rendering, so the delay in Unload should
not
be countered into page request''s processing time.

In addition, though PreInit/PreRender pair can get the most page request
processing time, if you want to handle the complete time, the best choice
should be use a custom httpmodule and use the HttpApplication pipeline
events to caculate the time. The "PreRequestHandlerExecute" and
"PostRequestHandlerExecute" events are the ones that fires before and
after
page handler process the request.

#ASP.NET Application Life Cycle Overview
http://msdn2.microsoft.com/en-us/library/ms178473.aspx

http://support.microsoft.com/kb/307985/en-us

However, the limitation of using custom httphandler and pipeline event is
that we can not access the control in page structure like in Page''s code,
but can only write content into current request''s response stream.
Please feel free to post here if you have any other consideration or
ideas.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================

This posting is provided "AS IS" with no warranties, and confers no
rights.



这篇关于在X秒内呈现的页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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