4

我的服务器中有以下代码

<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>节点吗?

4

1 回答 1

4

固定的!

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

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

而新的绑定配置如下:

<bindings>....
    <webHttpBinding>
    <binding name="webHttpsBinding">
        <security mode="Transport">
            <transport clientCredentialType="None" />
        </security>
    </binding>
</webHttpBinding>
......
</bindings>

这为端点提供了与 http 绑定的绑定,该绑定指定了传输信息的路径以及连接用户必须拥有的凭据类型

于 2012-11-15T23:04:34.427 回答