Why is the first WCF client call slow?

Solution 1:

Usually the first call takes more time because in that call the Channel Factory is instantiated and prepared ready for the communication and that costs time. The created Channel Factory will be cached and reused in subsequent calls and so the time will be less.

http://social.msdn.microsoft.com/Forums/en/wcf/thread/43f89088-546b-46b0-adf8-214deb1741bd

Solution 2:

If you are making calls to your WCF service less frequently than 15 seconds (we observed needing to wait about 20 seconds in our application), this Microsoft blog appears to explain your problem: http://blogs.msdn.com/b/wenlong/archive/2010/02/11/why-does-wcf-become-slow-after-being-idle-for-15-seconds.aspx

The article also links to this entry which mentions a fix for SetMinThreads() which also appears to be a contributing problem: http://blogs.msdn.com/b/wenlong/archive/2010/02/11/why-are-wcf-responses-slow-and-setminthreads-does-not-work.aspx

Solution 3:

I have similar problem. So what we actually did, we wrote service that invoke WCF service per some interval. I know that it's not an elegant solution but it's working.

Solution 4:

I was seeing delays in the range of 30 seconds when I was first creating my service proxy instance which I knew must be related to some sort of network timeout.

In the end for me it was actually checks for the Certificate Revocation List that were being blocked or frustrated by the corporate proxy (yay Websense) as highlighted here: WCF service startup too slow? Have you thought to CRL check?.

For future reference and in case the link goes dead it came down to adding the following to the client config:

<configuration>
  <runtime>
    <generatePublisherEvidence enabled=“false”/>
  </runtime>
</configuration>