http wcf error "Could not find a base address that matches scheme https for the endpoint with binding MetadataExchangeHttpsBinding..."

5181john picture 5181john · Oct 1, 2014 · Viewed 8.8k times · Source

am getting this error when i try to call my custom svc file from sharpoint. i have posted my web.config file here, could you guys tell wats wrong with this.

am trying to have my custom webservice in the sharepoint, so i created a project but due to this error i could not browse my web methods.

<?xml version="1.0"?>
<configuration>
  <system.serviceModel>
    <services>
      <service behaviorConfiguration="AlertWcfService.CustomServiceBehaviour"
        name="AlertWcfService.AlertService">
        <endpoint address="http://localhost:2000/" binding="basicHttpBinding" bindingConfiguration="basicHttpBindingConfiguration"
                  contract="AlertWcfService.IAlertService" >
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:2000/"></add>
          </baseAddresses>
        </host>
      </service>
    </services>
    <bindings>
      <basicHttpBinding>
        <binding name="basicHttpBindingConfiguration">
          <security mode="Transport">
            <transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
            <message clientCredentialType="Certificate" algorithmSuite="Default" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior name="AlertWcfService.CustomServiceBehaviour">
          <!--<serviceMetadata httpsGetEnabled="false"/>-->
          <serviceMetadata httpGetEnabled="false" httpsGetEnabled="false"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
</configuration>

Answer

tomasr picture tomasr · Oct 1, 2014

The error is that you're not using HTTPS, but you're using an MEX binding for HTTPS rather than HTTP. TO fix this, change this line:

    <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />

To

    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />