Click here to Skip to main content
15,917,061 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I need to find out the execution time of webservice methods that are hosted in IIS 7 in our c# code without modifying the webservice.


Regards
saurabh
Posted

It depends on how you define the execution time. If you cannot modify the service, you cannot get pure server-side time. You can observe the time including HTTP transport on the client side, but this is trivial. Just time the interval between sending HTTP request and receiving HTTP response. To exclude most of the client-side time span, you can create a request on low level using the class System.Net.HttpWebRequest:
http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.aspx[^].

The most precise way of timing is using the class System.Diagnostics.Stopwatch:
http://msdn.microsoft.com/en-us/library/system.diagnostics.stopwatch.aspx[^].

For more in-depth understanding of Web service profiling, please see this article:
http://www.netsoft-usa.com/en/HowToArticles/WebServiceProfiling.aspx[^].

—SA
 
Share this answer
 
Comments
Espen Harlinn 6-Sep-12 6:32am    
5'ed!
Sergey Alexandrovich Kryukov 6-Sep-12 13:04pm    
Thank you, Espen.
--SA
IIS W3SVC Performance Counter Availability[^] is a good place to start.

Best regards
Espen Harlinn
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900