找不到与具有绑定 WebHttpBinding 的端点的方案 https 匹配的基地址。注册的基地址方案是 [http]
Posted
技术标签:
【中文标题】找不到与具有绑定 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] 【发布时间】:2012-04-06 17:52:50 【问题描述】:我已经浏览了几个建议解决此问题的网站,但我仍然无法摆脱它。
我的网络配置:
<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 完成这项工作
【问题讨论】:
您是否在 IIS 上为托管此应用程序的网站映射了服务证书?您在网站上启用了 https 绑定吗? 你得到最终解决方案了吗? 【参考方案1】:改变
<serviceMetadata httpsGetEnabled="true"/>
到
<serviceMetadata httpsGetEnabled="false"/>
您告诉 WCF 使用 https 作为元数据端点,我看到您在 http 上公开您的服务,然后您在标题中看到错误。
如果您想按照您的 URL 建议使用 HTTP,您还必须设置 <security mode="None" />
。
【讨论】:
我很抱歉错字错误,我真的必须使用 https。您的答案适用于 http,但它如何适用于 https?谢谢 您是否在 IIS 中为您的站点设置了 ssl 绑定? 为了清楚起见,您是否在 Visual Studio 的 Web 服务器中运行您的服务?它不支持 SSL。如果您需要使用 SSL 进行开发,请使用 IIS Express。【参考方案2】:您需要在服务器端启用 https 绑定。 IISExpress 在这种情况下。在解决方案资源管理器中选择网站项目的属性(不是双击)。在属性窗格中,您需要启用 SSL。
【讨论】:
如果您的 Visual Studio 版本在您右键单击时不显示这些属性,请选择项目并按 F4。 你拯救了我的一天...谢谢伙计!【参考方案3】:我通过在我的 IIS 网站中添加 https 绑定并添加 443 SSL 端口并在绑定中选择自签名证书解决了这个问题。
【讨论】:
【参考方案4】:要让它工作,你必须替换运行这行代码
serviceMetadata httpGetEnabled="true"/>
http 而不是 https
和security mode="None" />
【讨论】:
【参考方案5】:在端点标签中,您需要包含属性 address=""
<endpoint address="" binding="webHttpBinding" bindingConfiguration="SecureBasicRest" behaviorConfiguration="svcEndpoint" name="webHttp" contract="SvcContract.Authenticate" />
【讨论】:
以上是关于找不到与具有绑定 WebHttpBinding 的端点的方案 https 匹配的基地址。注册的基地址方案是 [http]的主要内容,如果未能解决你的问题,请参考以下文章
WCF 错误“找不到与具有绑定 NetTcpBinding 的端点的方案 net.tcp 匹配的基地址”
找不到与端点方案 http 匹配的基地址,该端点具有绑定 WSHttpBinding 且没有解决方案
WCF--找不到具有绑定 BasicHttpBinding 的终结点的与方案 https 匹配的基址。注册的基址方案是 [http]。
在主机('Anonymous')上配置的身份验证方案不允许在绑定'WebHttpBinding'('Basic')上配置的那些