title: Connecting to WCF Web Service is inexplicably slow
body: <p>My company is currently transitioning from traditional ASMX webservices to WCF webservices, because we need the improved handling of complex types available with WCF.</p>
  
  <p>Whilst investigating performance issues with a web page, I have identified that the biggest (by some margin) performance sinkhole is the initial connection to the WCF service. When I say initial, I mean the following bit of code, every time it is called, a page refresh is enough to get a slow connection:</p>
  
  <pre><code>$client = new SoapClient("&lt;address-to-webservice&gt;",
  array('features' =&gt; SOAP_SINGLE_ELEMENT_ARRAYS));
  </code></pre>
  
  <p>Subsequent calls to the methods in this webservice are quick, however the connection is inexplicably slow.</p>
  
  <p>On the same page there is a connection to an ASMX service that is hosted on the same server, which connects much much quicker.</p>
  
  <pre><code>Connection to WCF Webservice took 1.6509809494019 seconds //(this is just calling new SoapClient)
  Connection to ASMX Webservice took 0.24430394172668 seconds
  
  Calling ASMX-&gt;Method
  ASMX-&gt;Method returned in 0.011564970016479 seconds
  
  Calling WCF-&gt;Method1
  WCF-&gt;Method1 returned in 0.011118173599243 seconds
  
  Calling WCF-&gt;Method2
  WCF-&gt;Method2 returned in 0.0038959980010986 seconds
  
  Calling WCF-&gt;Method3
  WCF-&gt;Method3 returned in 0.0041651725769043 seconds
  </code></pre>
  
  <p>This is running on an internal network, and obviously connecting from outside is even slower. As you can see the WCF Webservice connection is considerably slower.</p>
  
  <p>Is there a way to improve performance (considerably) when connecting to the WCF webservice?</p>
  
  <p>UPDATE:</p>
  
  <p>Some information about the WCF Client.
  Hosted on IIS 7, Windows Server 2008.
  Using BasicHttpBinding (as the PHP SoapClient doesn't support the more complex wsHttpBinding).
  The connection is using ssl.</p>
  
  <p>Additionally, when connecting via WCFStorm the connection is much faster, leading me to believe the issue is perhaps with the PHP SoapClient.</p>