VS2010创建了一个WCF Web Service;并在Server 2003下通过IIS 6部署;用VS2010创建了一个WinForm调用,打开WinForm后第一次调用很慢(不关闭WinForm,以后调用都很快);
关闭WinForm后,再立即打开WinForm,依然是第一次调用很慢,不关闭WinForm,以后调用都很快。有谁知道是为什么吗???
已经设置过useDefaultWebProxy="false"了。

解决方案 »

  1.   

    是不是接口很复杂?
    将serialize 和deserialize soap message(xml)使用xmlserialer第一次调用要进行动态编译。如果接口很复杂,wsdl很大的话,会有点慢。
    解决方案To speed up the initial call you can create the XmlSerializers dll at compile time. You can do this by setting your project build 'Generate serialization assembly' to on. This generates an MyApplication.XmlSerializers.dll containing the webservice information. Now the initial call dropped to 300 ms, presumably the loading of the dll. All calls there after take 0 ms.In Visual Studio right click on your project and choose 'Properties'. Go to the 'Build' Tab. There you have an option 'Generate Serialization assembly' in the 'Output' section. If you change the value to 'On' the serialization assembly will be generated during compile time.英语挺简单的,我就不翻译了
    来自
    http://stackoverflow.com/questions/784918/asmx-web-service-slow-first-request
      

  2.   

    正常,一般第一次要握手,TCP第一次也慢
      

  3.   

    这个,不光是WCF的webservice,就是传统的webservice也是慢的,毕竟有握手的过程么,如果实在是嫌慢,就异步调用一下,减少画面假死的不好的体验。不过java的调用要比.net的感觉上快一些,不知道axis做了什么好事~~~~
      

  4.   

    第一次要做初始化等很多事,所以慢啊,可以在formload的时候,加些等待,先调用一次不显示,我之前都是这么干的。
      

  5.   

    用VS2005 创建的asp.net web服务应用程序不会有这个问题。继续查找原因。。
      

  6.   

    2005也是一样的,应该说自从2002开始就是这个鬼样子,多年来微软并未更好的优化。楼主非得说2005不一样,那么随便简单创建一个webservice,仅仅存在一个hellowword好了,结果呢,还是一样的慢嘛。针对这个问题我许多年前就问过了,一直没解。