到.NET Web服务第一次调用速度较慢 [英] First call to a .net webservice is slow

查看:583
本文介绍了到.NET Web服务第一次调用速度较慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我打电话从我的.NET WinForms应用程序一个.NET Web服务,无论是在框架4.0。在程序的执行,第一次Web服务已调用的方法,调用大约需要10-12秒。后续调用时约1-2秒。后续调用,即使在Web引用实例重建,仍然〜1-2秒。当WinForms应用程序重新启动时,第一个呼叫时延再次出现,但后续的呼叫响应。

I'm calling a .net webservice from my .net winforms app, both in framework 4.0. During the execution of the program, the first time the webservice has a method called, the call takes ~10-12 seconds. Subsequent calls take ~1-2 seconds. Subsequent calls, even when the web reference instance is recreated, are still ~1-2 seconds. When the winforms app is restarted, the first call delay occurs again, but subsequent calls are responsive.

Web引用的实例将被调用前发生的历史创建的,并且是不延迟的一部分。

The instance of the web reference is being created prior to the call occuring, and is not part of the delay.

XmlSerializers的WinForms应用程序(和使用,据我知道,但我不知道如何验证这一点)。

XmlSerializers for the winforms app are being generated (and used, as far as I know, but I'm not sure how to verify this).

延迟不存在的,因为在Web服务端一个首轮汇编。这是正在全天中使用的生产web服务,以及其程序池的剩余量在存储器中。据我所看到的,延迟是发生或者在客户端之间,或客户机和服务器为该第一呼叫,但不是后续调用

The delay is not occuring because of a first-run compilation on the webservice side. This is a production webservice that is being used throughout the day, and its apppool is remaining in memory. As far as I can see, the delay is occurring either on the client side, or between the client and the server for that first call, but not subsequent calls.

不知道该怎么检查下一个。任何想法?

Not sure what to check next. Any ideas?

推荐答案

由于富豪曾表示,这个问题不得不做的代理检测。至于说关在Internet Explorer中解决了这个问题,但没有做我的情况下是可行的。

As spender had indicated, the issue had to do with the proxy detection. Turning that off in Internet Explorer solved the problem, but was not feasible to do in my situation.

相反,有一种变通方法来绕过使用默认的代理,因此自动检测。

Instead, there is a workaround to bypass the use of the default proxy, and therefore the automatic detection.

添加这些条目在app.config允许某些URL绕过代理:

Adding these entries to the app.config allows certain URLs to bypass the proxy:

<configuration>
    <system.net>
        <defaultProxy>
            <bypasslist>
                <add address="server/domain name" />
            </bypasslist>
        </defaultProxy>
    </system.net>
</configuration>

更多信息可以在这里找到:&LT; defaultProxy组件&gt;在MSDN

这篇关于到.NET Web服务第一次调用速度较慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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