locked
Implementing Basic Authentication on WCF Rest Service RRS feed

  • Question

  • User-1799376286 posted

    I am trying to implement basic authentication on WCF Rest Service over https and getting the following error on running it over localhost.

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

    What I am doing wrong here? Also could you please confirm that I have given the correct path for CustomUserNameValidator" in "customUserNamePasswordValidatorType="RESTService.CustomUserNameValidator, App_Code" as my CustomUserNameValidator.cs file stored in App_Code folder.

    <behavior name="JsonServiceBehaviors">
              <serviceDebug includeExceptionDetailInFaults="true" />
              <serviceCredentials>
                <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="RESTService.CustomUserNameValidator, App_Code" />
              </serviceCredentials>
            </behavior>

    Below are settings in web.config:

      <system.serviceModel>
        <behaviors>
          <serviceBehaviors>
            <behavior name="JsonServiceBehaviors">
              <serviceDebug includeExceptionDetailInFaults="true" />
              <serviceCredentials>
                <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="RESTService.CustomUserNameValidator, App_Code" />
              </serviceCredentials>
            </behavior>
          </serviceBehaviors>
          <endpointBehaviors>
            <behavior name="webHttpBehavior" >
              <webHttp />
            </behavior>
          </endpointBehaviors>
        </behaviors>
        <bindings>
    
          <webHttpBinding>
            <binding name="jsonp" crossDomainScriptAccessEnabled="true"  >
              <security mode="Transport">
                <transport clientCredentialType="Basic"/>
              </security>
            </binding>
           <binding name="jsonpSsl" crossDomainScriptAccessEnabled="true">
               <security mode="Transport">
                <transport clientCredentialType="Basic"/>
              </security>
            </binding>
          </webHttpBinding>
        </bindings>
        <services>
          <service name="RESTService.RESTService" behaviorConfiguration="JsonServiceBehaviors">
            <endpoint address="" binding="webHttpBinding"
              bindingConfiguration="jsonp" contract="RESTService.RESTService"
              behaviorConfiguration="webHttpBehavior"/>
           
            <endpoint address="" binding="webHttpBinding"
              bindingConfiguration="jsonpSsl" contract="RESTService.RESTService"
              behaviorConfiguration="webHttpBehavior"/>
          </service>
        </services>
      </system.serviceModel>

    And I am trying to access it via :

    http://localhost:55679/RESTService.svc





    Sunday, June 9, 2013 6:48 PM

Answers

All replies