ASP.NET监控page_load性能(无需更改代码)
我正在寻找的是某种方法来监视系统中每个页面的 page_load ,以计算出请求与发送回用户的数据结束之间的时间间隔。
我希望做到 100% 服务器端,并且我不想对应用程序代码进行任何代码更改。如果需要更改应用程序代码,是否有一个标准的地方可以进行这些更改?我正在考虑某种 web.config 类型参数,它将信息记录到位置/数据库。我们可以做处理部分,只需要某种方式的原始数据。
我希望收集的信息是:
- 页面名称(包括查询字符串)
- 请求的日期时间 花费
- 的时间
- 我们可以掌握的有关请求的任何其他信息!
显然,先决条件是它不应该影响性能。
我也在寻找低成本的东西,或者我们可以用来开发系统的方法。
其他信息: 更清楚地说,我们可以完全控制 IIS 和底层操作系统,但是,网站应用程序不在我们的控制范围内。我们可以更改配置文件,但不能更改应用程序的实际代码。
我们目前使用的是 IIS 6.0,但是,如果这种事情更高效,并且/或可以开箱即用,使用 IIS 7.0/7.5,那么它可能会加快向此方向的迁移,所以很高兴听到这些建议。
What I'm looking for is some way to monitor the page_load of every page in the system to work out how long between the request and the end of the data being sent back to the user is.
I'm looking to do this 100% server side, and I don't want to make any code changes to the application code. If application code changes would be required, is there a standard place to make these? I'm thinking some kind of web.config type parameter that will log the information to a location/database. We can do the processing part, just need the raw data somehow.
The information I'd be looking to gather is:
- Page name (including query string)
- DateTime of the request
- The amount of time it took
- Any additional information about the request that we can get our hands on!
Obviously, the pre-requisite is that it shouldn't impact performance.
I'm also looking for either something low cost, or a methodology that we can develop our system with.
Additional Information:
To be clearer, we have full control of the IIS and underlying operating system, however, the website application is outside of our control. We can change configuration files, but not actual code of the application.
We're using IIS 6.0 currently, however, if this kind of thing is more efficient, and/or works out of the box, with IIS 7.0/7.5 then it may speed up the move to this so happy to hear about those suggestions.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这不是 WebForms 问题,而是 ASP.net 问题。使用
global.asax
或IHttpModule
挂钩到BeginRequest
/EndRequest
事件来跟踪请求的持续时间需要。StopWatchModule.cs
Web.config
我是凭记忆写的,所以上面可能有错误,但这就是想法。您的日志消息可以根据您的需要详细说明。 Logger 是某种类型的日志库。我更喜欢 log4net,但选择权在你。
This isn't a WebForms concern, it's an ASP.net concern. Using either
global.asax
, or anIHttpModule
hook into theBeginRequest
/EndRequest
events to track how long a request takes.StopWatchModule.cs
Web.config
I'm writing from memory so there may be errors above, but that's the idea. your log message can be as detailed as you want. and Logger is some type of logging library. I prefer log4net, but the choice is yours.
你能碰一下global.asax吗?您可以在接收、完成、失败等请求时覆盖应用程序事件。
根据您的需要,您也可以尝试解析 IIS 日志,因为您可以向其中添加一些性能指标。
Can you touch global.asax? You can override Application events there for when a request is received, completed, failed, etc.
Depending on what all you need you might also try parsing IIS logs since you can add some performance metrics to that.
您始终可以在 web.config 中使用选项 pageOutput = "false" 启用跟踪。
然后,您可以转到trace.axd 查看特定请求的信息。
您还可以通过在 @page 指令中设置特定页面来执行此操作。
You can always enable tracing in your web.config, with the options pageOutput = "false".
You can then go to trace.axd to view information for a specific request.
You can also do this for a specific page by setting it in your @page directive.
我想知道 IIS 日志的耗时字段是否有任何用处,因为它会为您提供时间、IP、字节(发送/接收)等。
请参阅 字段 了解更多信息
I wonder if the IIS logs' time-taken field can be of any use since it will provide you with time, IP, bytes (sent/received), etc.
See fields for additional information