简体   繁体   中英

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

I write a SL+WCF UserName Password authorization Demo according to the Link below.But I can't get rid of it.

My Web.config:

http://blogs.infosupport.com/silverlight-3-securing-your-wcf-service-with-a-custom-username-and-password-authentication-mechanism/

<?xml version="1.0" encoding="utf-8"?>

    <configuration>
        <system.web>
            <compilation debug="true" targetFramework="4.0" />
        </system.web>

        <system.serviceModel>



      <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
      <services>
        <service name="Sample.Web.Service" behaviorConfiguration="ServiceBehavior" >

          <host>
             <baseAddresses>
                <add baseAddress="https://localhost"/>
             </baseAddresses>
          </host>

          <endpoint address="" binding="basicHttpBinding" bindingConfiguration="test" contract="Sample.Web.IService">
            <identity>
              <

    dns value="localhost"/>
                </identity>
              </endpoint>
              <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />

            </service>
          </services>

          <bindings>
            <basicHttpBinding>
              <binding name="test">
                <security mode="TransportWithMessageCredential">
                  <message clientCredentialType="UserName"/>
                </security>
              </binding>
            </basicHttpBinding>
          </bindings>

          <behaviors>
            <serviceBehaviors>
              <behavior name="ServiceBehavior">
                <serviceMetadata />
                <serviceDebug includeExceptionDetailInFaults="false" />
                <serviceCredentials>
                   <userNameAuthentication userNamePasswordValidationMode="Custom"
                       customUserNamePasswordValidatorType="Sample.Web.MyValidator, Sample.Web"/>
                </serviceCredentials>
              </behavior>
            </serviceBehaviors>
          </behaviors>

        </system.serviceModel>
    </configuration>

Hope someone could help. Thanks in advance!.

You are getting this exception because you haven't configured IIS on your machine to support HTTPS for the website under which this application is hosted. WCF requires a Secure HTTP connection when you use this specified security option. You need to map a service certificate on IIS for the website in question.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM