title: WCF Service- The protocol 'https' is not supported
body: <p>I am developing a WCF service using WsHttpBinding and an SSL certificate for security.  Works perfectly in my local IIS, but when I publish I get the following error message;</p>
  
  <blockquote>
    <p>The protocol 'https' is not supported.</p>
  </blockquote>
  
  <p>Here is my web.config file..</p>
  
  <pre><code>&lt;system.serviceModel&gt;
  &lt;services&gt;
    &lt;service name="PeopleService.Service.PeopleService"&gt;
      &lt;host&gt;
        &lt;baseAddresses&gt;
          &lt;add baseAddress="https://www.mywebsite.com/service/"/&gt;
        &lt;/baseAddresses&gt;
      &lt;/host&gt;
      &lt;endpoint address="" binding="wsHttpBinding" bindingConfiguration="BasicBinding" contract="PeopleService.Service.IPeopleService" name="BasicEndpoint"/&gt;
    &lt;/service&gt;
  &lt;/services&gt;
  &lt;bindings&gt;
    &lt;wsHttpBinding&gt;
      &lt;binding name="BasicBinding"&gt;
        &lt;security mode="TransportWithMessageCredential"&gt;
          &lt;message clientCredentialType="UserName"/&gt;
        &lt;/security&gt;
      &lt;/binding&gt;
    &lt;/wsHttpBinding&gt;
  &lt;/bindings&gt;
  </code></pre>
  
  <p></p>
  
  <p>I am using a ServiceHost factory to add my endpoints, so that I can load the SSL certificate from a physical file rather than from the certificate store.</p>
  
  <pre><code>public class PeopleServiceHost : ServiceHost
  {
      public PeopleServiceHost(params Uri[] addresses) : base(typeof(PeopleService), addresses)
      {
  
      }
  
      protected override void InitializeRuntime()
      {
          Description.Behaviors.Find&lt;ServiceDebugBehavior&gt;().IncludeExceptionDetailInFaults = true;
          Description.Behaviors.Find&lt;ServiceDebugBehavior&gt;().HttpsHelpPageUrl = new Uri("https://www.mywebsite.com/service/PeopleService.svc/mex");
  
          ServiceMetadataBehavior metadataBehavior = new ServiceMetadataBehavior();
          metadataBehavior.HttpsGetEnabled = true;
          metadataBehavior.HttpsGetUrl = new Uri("https://www.mywebsite.com/service/PeopleService.svc/mex");
          Description.Behaviors.Add(metadataBehavior);
  
          var serviceCredentials = new ServiceCredentials();
          serviceCredentials.ServiceCertificate.Certificate = new X509Certificate2(AppDomain.CurrentDomain.BaseDirectory + "\\mywebsite.pfx", "password123", X509KeyStorageFlags.MachineKeySet);
  
          Description.Behaviors.Remove((typeof(ServiceCredentials)));
          Description.Behaviors.Add(serviceCredentials);
  
          base.InitializeRuntime();
      }
  }
  </code></pre>
  
  <p>I've been trying to solve this problem for days, but to no avail.  I've contacted by host and they have advised me that HTTPS is definitely supported and enabled in IIS.</p>
  
  <p>Any help is really appreciated.  Thanks.</p>