Could not find a base address that matches scheme HTTPS error in IIS-hosted WCF

5.4k views Asked by At

I almost have everything set up to use my WCF service over https. IIS application is up and running, I can read the svc and wsdl at localhost. So I went back to Visual Studio and tried to write a Client that can call the service. When adding the ServiceReference I get the following error:

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

I've tried with the built-in development server and with IIS Express also. They both gave the same error.

Here's my web.config:

<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
  <system.serviceModel>
    <bindings>
      <wsHttpBinding>
        <binding name="TransportSecurity">
          <security mode="Transport">
            <transport clientCredentialType="None" />
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior name="SmartCook2.Server.ISmartCookServiceBehavior">
          <serviceMetadata httpsGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
    <services>
      <service behaviorConfiguration="SmartCook2.Server.ISmartCookServiceBehavior" 
        name="SmartCook2.Server.SmartCookService">
        <endpoint address="https://localhost:6344/SmartCookService.svc" 
          binding="wsHttpBinding" bindingConfiguration="TransportSecurity" 
          contract="SmartCook2.Server.ISmartCookService" />
        <endpoint address="mex" binding="mexHttpsBinding" 
          contract="IMetadataExchange" />
      </service>
    </services>
  </system.serviceModel>
 <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>
</configuration>

What am I doing wrong?

1

There are 1 answers

0
Tenshiko On BEST ANSWER

It seems VS didn't discover the address right, since it left out the application part. So the correct address for the service reference is :

https://localhost/IISHostedSmartCook/SmartCookService.svc