开发者

How to log each method's exection time on a page, business and data access layer in ASP.NET?

I have a complex ASP.NET application and it's running since 2009. I need to monitor it's performance and determine which methods in which layers are time or resource consumin开发者_如何学Pythong. Then I can optimize methods.

Right now, I'm using SQL Profiler to check the queries and I tune the database step by step. I want to do the same for other layers (UI, Service, and Repository).

I've used Postsharp and Enterprise Library Policy Injection Application Block.

I've implemented some attributes and add them to some classes which helps me to get BeforeMethodEntry and AfterMethodEntry (AOP model) automatically. Therefore, I can get the execution time of each method. It also handles exception log and page view log.

But, I think there may be another implemented/standard solution to monitor the running application.

PS: I've implemented some other solution like implementing ExceptionHttpModule and PageViewHttpModule which don't need any Third Party libraries. It doesn't meet my requirements.

*In a simple words, I want to log and monitor layer's activities (specially mehod execution duration). *


You may want to look into Spring.Net Aop. If you an AroundAdvice, you will be able to start a StopWatch before the execution of the method, and stopping right after it finishes. There is a way to use it as you would with PostSharp (i.e. using attributes).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜