我的服务器中有以下代码

<services>
  <service name="ME.Streets.WebGateway.DuplexService.DuplexService"
     behaviorConfiguration="sb">
    ....
    <endpoint
        address=""
        binding="webHttpBinding"
        behaviorConfiguration="webHttpEndpointBehavior"
        contract="ME.Streets.WebGateway.DuplexService.Interface.IPolicyRetriever"/>
     ....
    <host>
    <baseAddresses>
      <add baseAddress="https://localhost:10201" />
    </baseAddresses>
    </host>
  </service>

我一直在使用 SSL 和 WCF 将 Silverlight 应用程序切换到 HTTPS,但是如果我运行我的服务器,我收到以下错误
- System.InvalidOperationException: Could not find a base address that matches
 scheme http for the endpoint with binding WebHttpBinding. Registered base address
 schemes are [https].

我非常不确定这个错误的来源。我是否必须在 <baseaddress> 节点中安装 https <service> 节点?

最佳答案

固定的!

将端点更改为此(添加了 bindingConfiguration="webHttpsBinding"):

<services> .....
        <endpoint
            address=""
            binding="webHttpBinding"
            behaviorConfiguration="webHttpEndpointBehavior"
            bindingConfiguration="webHttpsBinding"
            contract="ME.Streets.WebGateway.DuplexService.Interface.IPolicyRetriever">
        </endpoint>
......
</services>

并且新的绑定(bind)配置如下:
<bindings>....
    <webHttpBinding>
    <binding name="webHttpsBinding">
        <security mode="Transport">
            <transport clientCredentialType="None" />
        </security>
    </binding>
</webHttpBinding>
......
</bindings>

这为端点提供了到 http 绑定(bind)的绑定(bind),该绑定(bind)指定传输信息的对象以及连接用户必须拥有的凭据类型

关于c# - wcf https ssl 中的服务端点出错。无法找到与绑定(bind) WebHttpBinding 的端点的方案 http 匹配的基地址,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/13402777/

10-13 03:13