【问题标题】:Configuration for web service metadata gives error over httpsWeb 服务元数据的配置在 https 上给出错误
【发布时间】:2016-02-23 19:37:53
【问题描述】:

我知道有关于此的线索,但我只是没有看到我在这里做错了什么。使用以下配置,当我尝试通过 https 访问服务时,出现以下错误: 找不到与具有绑定 WSHttpBinding 的端点的方案 https 匹配的基地址。注册的基地址方案是 [http]。` 这是我的 web.config 的相关部分。谢谢。

<system.serviceModel>

    <bindings>
        <wsHttpBinding>
            <binding name="sslBindingConfig">
                <security mode="Transport">
                    <transport clientCredentialType="None" />
                </security>
            </binding>
        </wsHttpBinding>
    </bindings>

    <services>
        <service name="MEA.SAWS.Service.SARuleService" behaviorConfiguration="ServiceBehavior">
            <!-- Service Endpoints -->
            <endpoint address="" 
                      binding="wsHttpBinding" 
                      bindingConfiguration="sslBindingConfig"
                      contract="MEA.SAWS.ServiceContract.ISARuleService">
            </endpoint>                                                      

            <endpoint address="mex" 
                      binding="mexHttpsBinding"
                      bindingConfiguration="" 
                      contract="IMetadataExchange" />
        </service>
    </services>

    <behaviors>
        <serviceBehaviors>
            <behavior name="ServiceBehavior">
                <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
                <serviceMetadata httpsGetEnabled="true"/>
                <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
                <serviceDebug includeExceptionDetailInFaults="true"/>
            </behavior>
        </serviceBehaviors>
    </behaviors>

</system.serviceModel>

【问题讨论】:

    标签: asp.net .net wcf


    【解决方案1】:

    将服务端点上的绑定更改为wsHttpsBinding 而不是wsHttpBinding

        <endpoint address="" 
                  binding="wsHttpsBinding" 
                  bindingConfiguration="sslBindingConfig"
                  contract="MEA.SAWS.ServiceContract.ISARuleService">
    

    【讨论】:

    • 我不认为这是一个有效的绑定了。
    【解决方案2】:

    如果这可能在将来对其他人有所帮助,我想通了。问题是负载均衡器后面的所有服务器都只绑定到 https,而负载均衡器是 SSL。因此,基本上绑定必须始终完全匹配的 WCF 格言在这里并不适用。客户端调用必须配置为 https,但服务器端点必须配置为 http。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-29
      • 1970-01-01
      相关资源
      最近更新 更多