簡體   English   中英

找不到與具有綁定 WebHttpBinding 的端點的方案 https 匹配的基址。 注冊的基址方案是 [http]

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

我的網絡配置:

<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>

我必須讓這個工作
https://localhost:6188/Authenticate/Login?username=user&password=pass&ip=127.0.0.1

改變

<serviceMetadata httpsGetEnabled="true"/>

<serviceMetadata httpsGetEnabled="false"/>

您告訴 WCF 將 https 用於元數據端點,我看到您在 http 上公開您的服務,然后您在標題中收到錯誤消息。

如果您想按照您的 URL 建議使用 HTTP,您還必須設置<security mode="None" />

您需要在服務器端啟用 https 綁定。 在這種情況下,IISExpress。 在解決方案資源管理器中選擇網站項目上的屬性(不是雙擊)。 在屬性窗格中,您需要啟用 SSL。

要使其工作,您必須替換運行這一行代碼serviceMetadata httpGetEnabled="true"/> http 而不是 https 和security mode="None" />

在端點標簽中,您需要包含屬性 address=""

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

我通過在我的 IIS 網站中添加 https 綁定並添加 443 SSL 端口並在綁定中選擇一個自簽名證書來解決這個問題。

在此處輸入圖片說明

在我們的例子中; 我不得不從配置文件中刪除“<baseAddressPrefixFilters”。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM