IIS分析-需要找到Web服务方法的执行时间 [英] IIS Profiling - need to find the execution time of webservice methods

查看:46
本文介绍了IIS分析-需要找到Web服务方法的执行时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我需要在我们的C#代码中找出IIS 7中托管的Web服务方法的执行时间,而无需修改Web服务.


问候
saurabh

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

推荐答案

这取决于您如何定义执行时间.如果无法修改服务,则无法获得纯服务器端时间.您可以在客户端观察包括HTTP传输在内的时间,但这是微不足道的.只是在发送HTTP请求和接收HTTP响应之间的时间间隔内.要排除大多数客户端时间跨度,可以使用类System.Net.HttpWebRequest:
创建低级别的请求. http://msdn.microsoft.com/en-us/library/system.net. httpwebrequest.aspx [ ^ ].

最精确的计时方式是使用类System.Diagnostics.Stopwatch:
http://msdn.microsoft.com/en-us/library/system.diagnostics. stopwatch.aspx [ ^ ].

要更深入地了解Web服务分析,请参阅本文:
http://www.netsoft-usa.com/en/HowToArticles/WebServiceProfiling.aspx [ ^ ].

-SA
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


IIS W3SVC性能计数器可用性 [ ^ ]是一个不错的起点.

最好的问候
Espen Harlinn
IIS W3SVC Performance Counter Availability[^] is a good place to start.

Best regards
Espen Harlinn


这篇关于IIS分析-需要找到Web服务方法的执行时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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