title: WCF consume Https Web Service, error: Could not establish trust relationship for the SSL/TLS secure channel with authority
body: <p>Gives me this error when connecting to an https web service server:</p>
  
  <p><strong>Could not establish trust relationship for the SSL/TLS secure channel with authority</strong></p>
  
  <p>I am using message layer security, body is encrypted with the CERT certificate. The certificate validation for server certificate is not controlled by the ServicePointManager.ServerCertificateValidationCallback delegate, this I can not use to accept the certificate. 
  The <a href="https://xxxxx.com/callservice" rel="nofollow noreferrer">https://xxxxx.com/callservice</a> certificates are loaded on the calling server, what am I doing wrong? ¿some example to load certificate?</p>
  
  <p>If you have any doubt tell me to answer you.</p>
  
  <p>web.config</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;system.serviceModel&gt;
      &lt;extensions&gt;
        &lt;bindingElementExtensions&gt;
          &lt;add name="SecurityBindingElement" type="Service.AsymetricSecurityExtentionElement, Service, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" /&gt;
        &lt;/bindingElementExtensions&gt;
      &lt;/extensions&gt;    
      &lt;bindings&gt;
        &lt;customBinding&gt;
          &lt;binding name="SUMA"&gt;
            &lt;MySecurityBindingElement/&gt;
            &lt;textMessageEncoding messageVersion="Soap11" /&gt;
            &lt;httpsTransport/&gt;
          &lt;/binding&gt;
        &lt;/customBinding&gt;
      &lt;/bindings&gt;
      
      &lt;client&gt;
        &lt;endpoint address="https://xxxxx.com/callservice"
          binding="customBinding" bindingConfiguration="SUMA" contract="ConsultaService"
          name="SUMA" behaviorConfiguration="cliBeh" &gt;
          &lt;identity&gt;
            &lt;certificateReference  storeLocation="LocalMachine" storeName="My" x509FindType="FindBySubjectName" findValue="CERT"/&gt;
          &lt;/identity&gt;
        &lt;/endpoint&gt;
      &lt;/client&gt;
      
      &lt;behaviors&gt;
        &lt;serviceBehaviors&gt;
          &lt;behavior&gt;
            &lt;serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/&gt;
            &lt;serviceDebug includeExceptionDetailInFaults="true"/&gt;
  
            &lt;serviceThrottling maxConcurrentCalls="1" maxConcurrentInstances="2147483647" maxConcurrentSessions="10" /&gt;
  
          &lt;/behavior&gt;
        &lt;/serviceBehaviors&gt;
        
        &lt;endpointBehaviors&gt;
          &lt;behavior name="cliBeh"&gt;
            &lt;clientCredentials&gt;
              &lt;clientCertificate storeLocation="LocalMachine" storeName="My" x509FindType="FindBySubjectName" findValue="CERT"/&gt;
            &lt;/clientCredentials&gt;
          &lt;/behavior&gt;
        &lt;/endpointBehaviors&gt;
              
      &lt;/behaviors&gt;
    &lt;/system.serviceModel&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Thank you very much for your help.</p>