C# 找不到与绑定 WebHttpBinding 的端点的方案 https 匹配的基地址。注册的基地址方案是 [http]
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9817718/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Could not find a base address that matches scheme https for the endpoint with binding WebHttpBinding. Registered base address schemes are [http]
提问by fiberOptics
I've been through several web site that suggest solution to this problem, but still I can't get rid of it.
我已经浏览了几个建议解决这个问题的网站,但我仍然无法摆脱它。
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>
Hope someone could help. Thanks in advance!.
希望有人能帮忙。提前致谢!。
Edit
编辑
I have to make this work with
https://localhost:6188/Authenticate/Login?username=user&password=pass&ip=127.0.0.1
我必须使用https://localhost:6188/Authenticate/Login?username=user&password=pass&ip=127.0.0.1来完成这项工作
采纳答案by KMan
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.
您告诉 WCF 将 https 用于元数据端点,我看到您在 http 上公开您的服务,然后您在标题中收到错误消息。
You also have to set <security mode="None" />if you want to use HTTP as your URL suggests.
您还必须设置<security mode="None" />是否要按照您的 URL 建议使用 HTTP。
回答by MrTony78
To make it work you have to replace a run this line of code
serviceMetadata httpGetEnabled="true"/>http instead of https
and security mode="None" />
为了使它工作,你必须替换运行这行代码
serviceMetadata httpGetEnabled="true"/>http 而不是 https 和security mode="None" />
回答by Softec
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.
您需要在服务器端启用 https 绑定。在这种情况下,IISExpress。在解决方案资源管理器中选择网站项目上的属性(不是双击)。在属性窗格中,您需要启用 SSL。
回答by Jose Lopez
In the endpoint tag you need to include the property address=""
在端点标签中,您需要包含属性 address=""
<endpoint address="" binding="webHttpBinding" bindingConfiguration="SecureBasicRest" behaviorConfiguration="svcEndpoint" name="webHttp" contract="SvcContract.Authenticate" />
<endpoint address="" binding="webHttpBinding" bindingConfiguration="SecureBasicRest" behaviorConfiguration="svcEndpoint" name="webHttp" contract="SvcContract.Authenticate" />


