简体   繁体   中英

Could not find a base address that matches scheme http for the endpoint with binding WSHttpBinding

I dida wcf username/password authentication on my local computer, with self signed certificate, all works fine, but when i put my application on IIS 7.5, and windows server 2008 R2, it gaves me the error:

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

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.serviceModel>
<behaviors>
  <serviceBehaviors>
    <behavior name="ServiceCredentialsBehavior">
      <serviceCredentials>
        <serviceCertificate findValue="cn=AmicCert" storeName="Root" storeLocation="LocalMachine" />
        <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="Util.CustomUserNameValidator, Util" />
      </serviceCredentials>
      <serviceMetadata httpGetEnabled="true" />
    </behavior>
  </serviceBehaviors>
</behaviors>
<services>
  <service behaviorConfiguration="ServiceCredentialsBehavior" name="Service">
    <endpoint address="" binding="wsHttpBinding" bindingConfiguration="MessageAndUserName" name="SecuredByTransportEndpoint" contract="IService" />
  </service>
</services>
<bindings>
  <wsHttpBinding>
    <binding name="MessageAndUserName">
      <security mode="Message">
        <message clientCredentialType="UserName" />
      </security>
    </binding>
  </wsHttpBinding>
</bindings>
      <client />
   </system.serviceModel>
  <system.web>
<compilation debug="true" />
 </system.web>
 </configuration>

It sounds like the IIS web site instance you're hosting under is only configured for HTTPS (SSL). Right click the web site instance and choose "Edit Bindings...". Do you see port 80 (plain HTTP) listed there? Also check the "SSL Settings" feature to make sure the "Always require" option is not turned on.

Drew's answer is correct if you don't want to use HTTPS/SSL for the endpoint.

If you do want to use SSL over the endpoint, you need to change your:

<security mode="Message">

to:

<security mode="TransportWithMessageCredential">

To get it work and still having the IIS to require SSL, you need to make some changes in your endpoint in the config file: Set the address property to the service's address with https ( https://... ) and the listenUri property to the service's address with http ( http://... ). This applies to both wsHttp and basicHttp .

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