0
votes

I have a WCF Service Application which will be deployed through IIS.

The development URL for the service is http://localhost:42543/Loyalty.svc, however when it is published to the web server the url will be http://ServerName:1066/Loyalty.svc .

However, when I navigate to the URL i get the following error:

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

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Could not find a base address that matches scheme https for the endpoint with binding WSHttpBinding. Registered base address schemes are [http].

The web.config for the site is here:

 <system.serviceModel>
    <bindings>
      <wsHttpBinding>
        <binding name="wsSecureBinding">
          <security mode="TransportWithMessageCredential">
            <message clientCredentialType="UserName"/>
            <transport clientCredentialType="None" proxyCredentialType="None" />
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
    <services>
      <service behaviorConfiguration="default" name="IISService.Loyalty">
        <endpoint address="" binding="wsHttpBinding" bindingConfiguration="wsSecureBinding" name="secureService" contract="IISService.ILoyalty"/>      
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="default">
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
          <serviceCredentials>
            <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="IISService.SecurityValidation, IISService"/>
          </serviceCredentials>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <protocolMapping>
      <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  </system.serviceModel>

I am also using the basic transport secuirty model as outlined here http://www.c-sharpcorner.com/UploadFile/manas1/implementing-username-password-security-in-wcf-service/.

Thanks in advance for your help.

1
Just a wild guess: You haven't configured https for your the site hosting your service in IIS yet, right?khlr

1 Answers

0
votes

It sounds like you do not have your respective servers configured for HTTPS.

IIS needs to have a port binding with HTTPS configured. see https://msdn.microsoft.com/en-us/library/hh556232%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396

Cassini does not support SSL and will not work. IIS Express will need to have SSL turned on in Visual Studio. See http://www.codeproject.com/Tips/723357/Enabling-SSL-with-IIS-Express-in-Visual-Studio