title: Error when configure HTTPS in WCF Service
body: <p>I have a Wcf Service in VS 2010, .NET 4.0.</p>
  
  <p>IIS site is virtual directory.</p>
  
  <p>I try configure it and access it using https</p>
  
  <blockquote>
    <p><a href="https://pruebaslba.xxxx.net/ServicioPyS/Service.svc?wsdl" rel="nofollow">https://pruebaslba.xxxx.net/ServicioPyS/Service.svc?wsdl</a></p>
  </blockquote>
  
  <p>But I get error</p>
  
  <pre><code>Could not find a base address that matches scheme https for the endpoint with binding WSHttpBinding. Registered base address schemes are [http].
  </code></pre>
  
  <p>or</p>
  
  <pre><code>Could not find a base address that matches scheme https for the endpoint with binding BasicHttpBinding. Registered base address schemes are [http].
  </code></pre>
  
  <p>Googleing, I have seen several alternatives about configurations: serviceMetadata, bindings, baseAddresses, ..</p>
  
  <p>I try different configurations, but I get the same error:</p>
  
  <p><strong>serviceMetadata</strong></p>
  
  <pre><code>&lt;serviceMetadata httpGetEnabled="false or true" httpsGetEnabled="true" /&gt;
  </code></pre>
  
  <p><strong>bindings</strong></p>
  
  <p>I use <code>&lt;security mode="Transport"&gt;</code></p>
  
  <pre><code> &lt;bindings&gt;
  
        &lt;basicHttpBinding&gt;
          &lt;binding name="SecureTransportOnly"&gt;
            &lt;security mode="Transport"&gt;
              &lt;transport clientCredentialType="None" proxyCredentialType="None" realm="" /&gt;
            &lt;/security&gt;
          &lt;/binding&gt;
  
          &lt;binding name="NoSecure"&gt;
            &lt;security mode="None"&gt;&lt;transport clientCredentialType="None"/&gt;&lt;/security&gt;
          &lt;/binding&gt;
  
        &lt;/basicHttpBinding&gt;
  
        &lt;wsHttpBinding&gt;
          &lt;binding name="SecureTransportOnly"&gt;
            &lt;security mode="Transport"&gt;
                &lt;transport clientCredentialType="None" proxyCredentialType="None" realm="" /&gt;
            &lt;/security&gt;
          &lt;/binding&gt;
  
        &lt;/wsHttpBinding&gt;
      &lt;/bindings&gt;
  </code></pre>
  
  <p><strong>endpoint</strong>  </p>
  
  <pre><code> &lt;endpoint
              address=""
              binding="basicHttpBinding"
              bindingConfiguration="SecureTransportOnly"
              name="xxxActualServiceEndPoint"
              bindingNamespace="https://pruebaslba.xxxx.net/ServicioPyS"
              contract="IxxxActualService"&gt;
  </code></pre>
  
  <p><strong>mex</strong></p>
  
  <pre><code>&lt;endpoint address="mex" binding="mexHttpBinding o mexHttpsBinding" contract="IMetadataExchange"/&gt;
  </code></pre>
  
  <p>And I tried too:</p>
  
  <pre><code>  &lt;!--&lt;host&gt;
            &lt;baseAddresses&gt;
              &lt;add  baseAddress="https://pruebaslba.xxxx.net o https://pruebaslba.xxxx.net/ServicioPyS"/&gt;
            &lt;/baseAddresses&gt;
          &lt;/host&gt;--&gt;
  
            &lt;!--&lt;identity&gt;
              &lt;dns value="localhost" /&gt;
            &lt;/identity&gt;--&gt;
  </code></pre>
  
  <p>I tried, I think, almost configurations that I've found in forums. I don't know the solution.</p>
  
  <p><strong>UPDATE</strong>
  I get more information about it.
  The website is in 2 servers (PreProduction environment): <strong>preiis01 and preiis02</strong>. <strong>SSL is not enabled.</strong></p>
  
  <p>I can Access to <a href="http://preiis01/ServicioPyS/Service.svc?wsdl" rel="nofollow">http://preiis01/ServicioPyS/Service.svc?wsdl</a> 
  All is OK by http.</p>
  
  <p><a href="https://pruebaslba.xxxx.net/ServicioPyS/Service.svc?wsdl" rel="nofollow">https://pruebaslba.xxxx.net/ServicioPyS/Service.svc?wsdl</a> is public url about NLB (load balanced, I think, F5). In NLB, SSL is configured. I dont know more information, only IT departament has all information.</p>
  
  <p>The problem is about WSDL</p>
  
  <p><strong><a href="http://preiis01/ServicioPyS/Service.svc?wsdl" rel="nofollow">http://preiis01/ServicioPyS/Service.svc?wsdl</a></strong></p>
  
  <pre><code>&lt;wsdl:service name="ActualService"&gt;
  
  &lt;wsdl:port name="ActualServiceEndPoint"binding="i0:ActualServiceEndPoint"&gt;
  
  &lt;soap:addresslocation="http://preiis01/ServicioPyS/Service.svc/Service.svc" /&gt;
  
  &lt;/wsdl:port&gt;
  
  &lt;/wsdl:service&gt;
  </code></pre>
  
  <p>url WSDL in NLB hast problema with <strong>soap:address location</strong> part and is not generated right (set http, and not https)</p>
  
  <p><strong><a href="https://pruebaslba.xxxx.net/ServicioPyS/Service.svc?wsdl" rel="nofollow">https://pruebaslba.xxxx.net/ServicioPyS/Service.svc?wsdl</a></strong></p>
  
  <pre><code>&lt;wsdl:service name="ActualService"&gt;
  
  &lt;wsdl:port name="ActualServiceEndPoint"binding="i0:ActualServiceEndPoint"&gt;
  
  &lt;soap:addresslocation="http://pruebaslba.xxxx.net/ServicioPyS/Service.svc/Service.svc" /&gt;
  
  &lt;/wsdl:port&gt;
  
  &lt;/wsdl:service&gt;
  </code></pre>
  
  <p>Quickly solution was modify manually WSDL (singlefile) and set <strong>https</strong> in <strong>soap:addresslocation</strong> part, in new url <em><a href="https://pruebaslba.xxxx.net/ServicioPyS/WSDL/ServiceWsdlModificado.Single.wsdl" rel="nofollow">https://pruebaslba.xxxx.net/ServicioPyS/WSDL/ServiceWsdlModificado.Single.wsdl</a></em></p>
  
  <p><strong><a href="https://pruebaslba.xxxx.net/ServicioPyS/WSDL/ServiceWsdlModificado.Single.wsdl" rel="nofollow">https://pruebaslba.xxxx.net/ServicioPyS/WSDL/ServiceWsdlModificado.Single.wsdl</a></strong></p>
  
  <pre><code>&lt;wsdl:service name="ActualService"&gt;
  
  &lt;wsdl:port name="ActualServiceEndPoint"binding="tns:ActualServiceEndPoint"&gt;
  
  &lt;soap:addresslocation="https://pruebaslba.xxxx.net/ServicioPyS/Service.svc/Service.svc"/&gt;
  
  &lt;/wsdl:port&gt;
  
      &lt;/wsdl:service&gt;
  </code></pre>
  
  <p>I think, there is another good solution with good practices. I don't know. </p>
  
  <p>Website in IIS has not SSL enabled, and NLB has SSL.</p>
  
  <p>Maybe “SSL pass-through” , I don't know</p>
  
  <p><a href="http://blog.tonysneed.com/2012/06/18/building-scalable-and-secure-wcf-services/" rel="nofollow">http://blog.tonysneed.com/2012/06/18/building-scalable-and-secure-wcf-services/</a></p>
  
  <p>Any suggestions?</p>