0

My ASP.NET Web Application serves on IIS 7.0 and .NET 4.0

I want to measure total duration for "any request to my web services methods (asmx)" This log needs to include some custom data (for example ID, given by my application).

I am planning to follow these steps:

-- Run application in Integrated Pipeline mode

-- Implement custom http module and attach to BeginRequest and EndRequest events of HttpApplication.

-- In BeginRequest method, Start Stopwatch

-- In EndRequest method; end Stopwatch; read custom ID data from context.Session; write results to database or file log.

Do you think it is a good method? What is the best way to achieve this, would you recommend other?

Ahmet Altun
  • 3,910
  • 9
  • 39
  • 64
  • Have you taken a look at ASP.NET tracing ? Here is MSDN documentation for it : http://msdn.microsoft.com/en-us/library/bb386420(v=vs.100).aspx – Fahad Jun 14 '13 at 13:59

1 Answers1

0

IIS will log time taken, and you can add any custom data that you wish.

You can even use ETW to read log objects instead of parsing the log files.

IIS logging:

http://msdn.microsoft.com/en-us/library/ms525410(v=vs.90).aspx

What "time taken" means:

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

Writing custom data to IIS logs from your app:

http://msdn.microsoft.com/en-us/library/system.web.httpresponse.appendtolog.aspx

Optionally interfacing through ETW instead of reading the logs from the file system:

http://msdn.microsoft.com/en-us/library/windows/desktop/bb968803(v=vs.85).aspx http://www.iis.net/learn/get-started/whats-new-in-iis-85/logging-to-etw-in-iis-85

Jonathan Roeder
  • 465
  • 5
  • 7