本文介绍了在差分时采取的IIS和AS​​P.NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发一个ASP.NET(3.5)Web服务应用程序,托管在IIS6 / Win2003的。 WebService的记录开始和刚刚返回之前调用的时间戳。这让我查询所用的时间,。我还增加了时间采取标准的IIS日志(W3C扩展)

WebService的是那么的压力测试(5个线程,每个线程200元话费)当比较时间采取从IIS与在datase的timetaken,我看到了巨大的差异!时间取自IIS(这也是时间采取主叫客户登录)比走的时间由ASP.NET记录高得多。例如,时间根据ASP.NET花费为1.7秒,而IIS日志12000(毫秒)!

有什么能引起此?

Dummy- code的服务:

  [的WebMethod(说明=的主要切入点,以服务。)
公共字符串治法(字符串theXmlInput)
{
    //先登录
    StoreInput(theXmlInput);    //运行作业,需时约1秒
    字符串结果= DOIT(theXmlInput);    //日志输出
    StoreResult(结果);    返回结果;
}


解决方案

刚刚发现的IIS的时候,采取包括网络时间。
这是因为IIS6,对于那些谁照顾。回到网络男孩!

I'm developing an ASP.NET (3.5) webservice application, hosted on IIS6/Win2003. The webservice logs the timestamp of the call at start and just before the return. This allows me to query the time-taken. I've also added time-taken to the standard IIS log (W3C extended)

The webservice is then stress-tested (5 threads, 200 calls per thread) When comparing the time-taken from IIS with the timetaken in the datase, I see HUGE differences! The time-taken from IIS (which is also the time-take logged by the calling clients) is much higher than the time-take logged by ASP.NET. For example, the time spent according to ASP.NET is 1.7 secs, while IIS logs 12000 (miliseconds)!

What could be a cause for this?

Dummy-code for the service:

[WebMethod(Description = " Main entry point to the service.")]
public string MethodA(string theXmlInput)
{            
    //log first
    StoreInput(theXmlInput);

    //Run the job, should take about 1 sec
    string result = DoIt(theXmlInput);            

    //log output
    StoreResult(result);

    return result;
}
解决方案

Just found out the the IIS time-taken includes NETWORK time. (see microsoft)This is since IIS6, for those who care. Back to the network boys!

这篇关于在差分时采取的IIS和AS​​P.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-02 11:24