wcfwshttpbinding

Getting "Could not find a base address that matches scheme http for the endpoint with binding WSHttpBinding. Registered base address schemes are []"


I have been through Stack Overflow and followed an online tutorial for SSL And WebHttpBinding.

I am getting back the same error as mentioned there. I have reverted back to the old web config as shown below. My https site is working fine, and I added my WCF as part of the site to avoid having to open a new port.

I'm trying to reach something like this now when I get the error:

https://localhost/_vti_bin/TestingSQL/sample.svc/mex

<?xml version="1.0"?>
<configuration>
  <system.serviceModel>
<services>
  <service name="SharePointBits.Samples.WCFService.SampleService" behaviorConfiguration="SharePointBits.Samples.WCFService.SampleServiceBehavior">
<host> 
<baseAddresses> 
            <add baseAddress="https://testsite/_vti_bin/TestingSQL/Sample.svc"/> 
        </baseAddresses> 
    </host>

    <endpoint address="https://localhost/_vti_bin/TestingSQL/Sample.svc" binding="wsHttpBinding" contract="SharePointBits.Samples.WCFService.ISampleService" 
bindingConfiguration="wsHttpBindingEndpointBinding">
          <identity>
            <dns value="localhost"/>
      </identity>
  </endpoint>
  <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
  </service>
</services>
<bindings>
  <wsHttpBinding>
    <binding name="wsHttpBinding">
      <security mode="Transport">
        <transport clientCredentialType="None"/>
      </security>
    </binding>
  </wsHttpBinding>
</bindings>
<behaviors>
  <serviceBehaviors>
    <behavior name="SharePointBits.Samples.WCFService.SampleServiceBehavior">
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
      <serviceMetadata httpsGetEnabled="true"/>
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug includeExceptionDetailInFaults="true"/>
    </behavior>
    <!--<behavior name="">-->
      <!--<serviceMetadata httpGetEnabled="true" />-->
    <!--</behavior>-->
  </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
</configuration>'

After I added my web address a new error occurs:

Could not find a base address that matches scheme https for the endpoint with binding MetadataExchangeHttpsBinding. Registered base address schemes are [].

I tried both ways and both have errors.

Adding an absolute address to metadatabinding gets me this error:

The HttpsGetEnabled property of ServiceMetadataBehavior is set to true and the HttpsGetUrl property is a relative address, but there is no https base address. Either supply an https base address or set HttpsGetUrl to an absolute address.

Using the base address I get this error:

Could not find a base address that matches scheme https for the endpoint with binding MetadataExchangeHttpsBinding. Registered base address schemes are [].

Note: I have changed the code above using the base address.


Solution

  • You have a MEX endpoint with an address that makes WCF think it's relative, but you haven't provided a base address. Change the MEX endpoint for example to:

    <endpoint address="https://testsite/_vti_bin/TestingSQL/mex" 
              binding="mexHttpsBinding" 
              contract="IMetadataExchange"/>
    

    Either that, or specify a BaseAddress and use that on your endpoints.

    In addition, you may want to tweak the serviceMetaData element, specifically the httpsGetUrl.