c# - 找不到与具有绑定(bind) WebHttpBinding 的终结点的方案 https 匹配的基址。注册的基址方案是 [http]

标签 c# wcf rest https web-config

我已经浏览了几个建议解决这个问题的网站,但我仍然无法摆脱它。

我的网络配置:

<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 上公开您的服务,然后您在标题中收到错误。

您还必须设置 <security mode="None" />如果您想按照 URL 的建议使用 HTTP。

关于c# - 找不到与具有绑定(bind) WebHttpBinding 的终结点的方案 https 匹配的基址。注册的基址方案是 [http],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9817718/

相关文章:

xml - Node.JS 接收发布数据的奇怪行为

c# - 在嵌套的转发器中使用数据列表项

c# - WCF 使用接口(interface)参数调用服务方法导致 SocketException

c# - WCF 服务不向 jQuery 返回值

c# - 捕获所有异常

java - Spring Boot Rest Web服务在Get Request中获取多个参数

java - 从 JAX-RS 中的帖子检索数据

c# - 检查表达式中的循环依赖

c# - 使用 lambda 表达式比较两个列表

c# - 将 GIF 文件保存到图片文件夹吗?