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很大的话,会有点慢。
      

  2.   

    解决方案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