![](/img/trans.png)
[英]Could not find a base address that matches scheme http for the endpoint with binding WSHttpBinding. Registered base address schemes are [https]
[英]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" />
在我們的例子中; 我不得不從配置文件中刪除“<baseAddressPrefixFilters”。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.