简体   繁体   中英

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

My WebConfig:

<bindings>
  <webHttpBinding>
    <binding name="SecureBasicRest">
      <security mode="Transport" />
    </binding>
  </webHttpBinding>
</bindings>
<behaviors>
  <serviceBehaviors>
    <behavior name="svcBehavior">
      <serviceMetadata httpsGetEnabled="true"/>
      <serviceDebug includeExceptionDetailInFaults="false"/>
    </behavior>
  </serviceBehaviors>
  <endpointBehaviors>
    <behavior name="svcEndpoint">
      <webHttp helpEnabled="true"/>
      <enableWebScript/>
    </behavior>
  </endpointBehaviors>
</behaviors>
<services>
  <service name="SvcContract.Authenticate" behaviorConfiguration="svcBehavior">
    <endpoint binding="webHttpBinding" bindingConfiguration="SecureBasicRest"
              behaviorConfiguration="svcEndpoint" name="webHttp"
              contract="SvcContract.Authenticate" />
  </service>
</services>

I have to make this work with
https://localhost:6188/Authenticate/Login?username=user&password=pass&ip=127.0.0.1

Change

<serviceMetadata httpsGetEnabled="true"/>

to

<serviceMetadata httpsGetEnabled="false"/>

You're telling WCF to use https for the metadata endpoint and I see that your'e exposing your service on http, and then you get the error in the title.

You also have to set <security mode="None" /> if you want to use HTTP as your URL suggests.

You would need to enable https binding on server side. IISExpress in this case. Select Properties on website project in solution explorer (not double click). In the properties pane then you need to enable SSL.

要使其工作,您必须替换运行这一行代码serviceMetadata httpGetEnabled="true"/> http 而不是 https 和security mode="None" />

在端点标签中,您需要包含属性 address=""

<endpoint address="" binding="webHttpBinding" bindingConfiguration="SecureBasicRest" behaviorConfiguration="svcEndpoint" name="webHttp" contract="SvcContract.Authenticate" />

I solved the issue by adding https binding in my IIS websites and adding 443 SSL port and selecting a self signed certificate in binding.

在此处输入图片说明

In our case; I had to remove the "<baseAddressPrefixFilters" from the config file.

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