I have been struggling for a few days with an issue with our WPF applications and I wonder if someone has come across this before and can help? The problem seems to boil down to the client generating "on-the-fly" a serializer to handle the types in that web method call. When that method is called for the first time (the web service itself has been running already), it may take e.g. 8 seconds, subsequent calls may take e.g. 20ms. The CPU on the client WPF process is v. high during this delay.
When using the XmlSerializer, there is a way of pre-generating these serializer assemblies, using svcutil. When (as we are) using the normal WCF DataContractSerializer, this option does not seem to be present.
What I would like is to be able to pre-generate this assembly for all types in all my data contracts (a lot) or, alternatively, to replace this process with a custom one that I can code and passes the data in binary (we own both ends of this webservice/client and they are both .NET 4). I have already used BinaryForamtter and GZip compression and while this speeds up the transfer of data, it always gets restored to XML to be de-serialized by the framework, hence this problem remains.
Any ideas?