title: Initial web service call takes a long time in .NET
body: <p>I have a WCF web service hosted in IIS using HTTPS. Both the service and client app are written in C#. The first web service call that the client app makes takes over 15 seconds to complete. Once that initial call is made, subseqent calls complete in about 100 milliseconds. For testing, I have a simple method: string Ping(int val); that simply echoes back the number passed in as a string.</p>
  
  <p>The odd thing is that a user a thousand miles away reported this problem but I was not experiencing it on my development machine. I was only seeing the first request taking 2 to 3 seconds. Now virtually every client is reporting that the first request takes more than 15 seconds.</p>
  
  <p>Is this normal behavior for a C# client? Has anyone experienced this problem?</p>
  
  <p>My web service binding is configured as follows:</p>
  
  <pre><code>&lt;basicHttpBinding&gt;
    &lt;binding
      name="BasicHttpBinding_IMyWebSvc"
      maxBufferSize="16777216"
      maxReceivedMessageSize="16777216"
      messageEncoding="Mtom"&gt;
      &lt;readerQuotas
        maxDepth="1024"
        maxStringContentLength="262144"
        maxArrayLength="16777216"
        maxBytesPerRead="16777216"
        maxNameTableCharCount="16777216"
      /&gt;
      &lt;security mode="Transport"&gt;
        &lt;transport clientCredentialType="None"/&gt;
      &lt;/security&gt;
    &lt;/binding&gt;
  &lt;/basicHttpBinding&gt;
  </code></pre>
  
  <p>Edit: This problem gets weird.</p>
  
  <p>I wrote a test client using trimmed down proxy code that had nothing but the Ping() test method. Ran the test and it still took >15 seconds. Started changing the clients buffer sizes since the Ping() function does not need large buffers and the problem went away. Restored the buffer sizes to their original values and the problem did NOT come back. Ran the real client and the first call completed in 1.2 seconds. Now I cannot reproduce the problem on my development PC.</p>