Improving the start-up time of WCF clients



When using the Windows Communication Foundation on the client side, especially when consuming non-WCF services, startup time (the time it takes to make the very first call to the web service) can often be dramatically improved by following the steps in http://msdn2.microsoft.com/en-us/library/aa751883.aspx.


What happens under the hood: When using WCF to consume a non-WCF service, the schema for the service is often incompatible with the DataContractSerializer. WCF automatically falls back to using the older XmlSerializer. The XmlSerializer has a fairly slow startup time - during the first call, it generates serialization code to be used for calling the service, compiles it and loads the resulting assembly. This can take many seconds. To avoid this, the steps in the link above instruct you how to pre-generate this serialization assembly in advance. This is equivalent to using the sgen.exe tool in the older "ASMX" technology.


Skip to main content