title: WCF/SSL error: Failed to lookup a channel to receive an incoming message
body: <p>I've been having a difficult time getting a WCF call in Silverlight to work when using SSL. I've gotten it to a point where WCF tracing says the endpoint is listening but when my code tries to call a function on it WCF Tracing shows the error:</p>
  
  <p>Failed to lookup a channel to receive an incoming message. Either the endpoint or the SOAP action was not found.</p>
  
  <p>If I browse to the services URL I properly get the service page, but calling it in code it always fails. Again, this only happens on HTTPS, not before when I was using HTTP. Of course there were a number of config changes to add to use SSL. I should note that the WCF Domain Services functions work fine over SSL, just not the WCF Service. Below are my various config file sections</p>
  
  <p>Web.config</p>
  
  <pre><code>&lt;system.serviceModel&gt;
      &lt;domainServices&gt;
        &lt;endpoints&gt;
          &lt;add name="OData" type="System.ServiceModel.DomainServices.Hosting.ODataEndpointFactory, System.ServiceModel.DomainServices.Hosting.OData, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /&gt;
        &lt;/endpoints&gt;
      &lt;/domainServices&gt;
      &lt;serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /&gt;
      &lt;behaviors&gt;
        &lt;endpointBehaviors&gt;
          &lt;behavior&gt;
            &lt;serviceMetadata httpsGetEnabled="true"/&gt;
            &lt;serviceDebug includeExceptionDetailInFaults="true"/&gt;
          &lt;/behavior&gt;
        &lt;/serviceBehaviors&gt;
      &lt;/behaviors&gt;
  
      &lt;bindings&gt;
        &lt;basicHttpBinding&gt;
          &lt;binding name="secureHttpBinding" maxReceivedMessageSize="20000" maxBufferSize="20000"&gt;
            &lt;security mode="Transport"&gt;
              &lt;transport clientCredentialType="None"/&gt;
            &lt;/security&gt;
            &lt;readerQuotas maxArrayLength="20000" maxStringContentLength="20000" /&gt;
          &lt;/binding&gt; 
        &lt;/basicHttpBinding&gt;
  
      &lt;/bindings&gt;
      &lt;services&gt;
        &lt;service name="PictureService"&gt;
          &lt;endpoint address="https://MyServer/AdvisorDev/PictureService.svc"
                    binding="basicHttpBinding"
                    bindingConfiguration="secureHttpBinding"
                    contract="PictureService.IPictureService"/&gt;
  
          &lt;endpoint address="mex"
                    binding="mexHttpsBinding"
                    contract="IMetadataExchange" /&gt;
        &lt;/service&gt;
      &lt;/services&gt;
    &lt;/system.serviceModel&gt;
  
  ServiceReferences.ClientConfig:
  
  &lt;configuration&gt;
    &lt;system.serviceModel&gt;
      &lt;bindings&gt;
        &lt;basicHttpBinding&gt;
          &lt;binding name="BasicHttpBinding_IPictureService" maxBufferSize="2147483647"
            maxReceivedMessageSize="2147483647"&gt;
            &lt;security mode="Transport" /&gt;
          &lt;/binding&gt;
        &lt;/basicHttpBinding&gt;
      &lt;/bindings&gt;
      &lt;client&gt;
        &lt;endpoint address="https://MyServer/AdvisorDev/PictureService.svc"
          binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IPictureService"
          contract="PictureService.IPictureService" name="BasicHttpBinding_IPictureService" /&gt;
      &lt;/client&gt;
    &lt;/system.serviceModel&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>Create client:</p>
  
  <pre><code>PictureService.PictureServiceClient client = new PictureService.PictureServiceClient();
  </code></pre>
  
  <p>I am running this on my Dev machine using VS 2012 and using IIS as my web server. IIS is using a self-signed certificate. When my site first loads I do get the "There is a problem with this website's security certificate" error, click continue, and the rest of the application runs fine again including the Domain Service calls which use a dynamically created proxy. I create my proxy for this failing WCF service using "Add Service Reference"
  One of my sources for SSL is this:
  <a href="http://msdn.microsoft.com/en-us/library/hh556232(v=vs.110).aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/hh556232(v=vs.110).aspx</a></p>
  
  <p>This is the service I implemented:
  <a href="http://www.silverlightshow.net/items/Uploading-and-downloading-images-from-WCF-in-Silverlight.aspx" rel="nofollow">http://www.silverlightshow.net/items/Uploading-and-downloading-images-from-WCF-in-Silverlight.aspx</a></p>
  
  <p>I appreciate all advice on this, thank you.</p>