Wcf – Could not find a base address that matches scheme https for the endpoint with binding WSHttpBinding

asp.netiiswcfwshttpbinding

I got error while running the WCF application in my local project. Its working fine in iis. Please help me to solve this. This is my error.Could not find a base address that matches scheme https for the endpoint with binding WSHttpBinding. Registered base address schemes are [http].

<system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="ServiceBehaviour">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
          <serviceCredentials>
            <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="HelpDeskAdaptor.CustomValidator,HDAdaptorService" />
          </serviceCredentials>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
      <wsHttpBinding>
        <binding name="SafeServiceConf" maxReceivedMessageSize="65536">
          <readerQuotas maxStringContentLength="65536" maxArrayLength="65536" maxBytesPerRead="65536" />
          <security mode="TransportWithMessageCredential">
            <message clientCredentialType="UserName" />
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
    <services>
      <service behaviorConfiguration="ServiceBehaviour" name="HelpDeskAdaptor.HDAdaptorService">
        <endpoint address="" binding="wsHttpBinding" bindingConfiguration="SafeServiceConf" name="wsHttpBinding" contract="HelpDeskAdaptor.IHDAdapterService.cs">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
      </service>
    </services>
  </system.serviceModel>

Best Answer

Threre is a mismatch between your hosting environnement and the service configuration. This config requires https because of Security/Mex, and only http is available It depends on your context, but you have two options :

  • Create an https binding in IIS

or

  • Change the config of you service to run under http

Remove this line from your config

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

and change security config to

   <security mode="None">