title: HttpWebRequest fails when called via WCF
body: <p>I wrote a piece of code which passes SOAP envelopes to a client.  The request carries a certificate, and the payload is signed with the certificate.  I wrote a test harness which uses the HttpWebRequest to call the server successfully.  The source was integrated into another project, a WCF service.  We use SoapUi to call our service, which in turn uses the HttpWebRequest to call the client.  When we deploy my test harness or our service, it's to the same application folder on the same server.</p>
  
  <p>As far as I can tell, there are no <strong>material</strong> differences between my source and theirs.  However, their code always fails with a certificate error:  "The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel".  This error has been discussed before, the most complete discussion seemed to be here (<a href="https://stackoverflow.com/questions/11222759/error-c-sharp-the-underlying-connection-was-closed-could-not-establish-trust-r">Error: C# The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel</a>), but the approaches covered have not worked for me.</p>
  
  <p>Would the behaviour of HttpWebRequest change because it's being called from within a WCF service?  I'm at a loss as to where to look next.</p>