Web服务元数据的配置通过https提供错误

时间:2016-02-23 19:37:54

标签: asp.net .net wcf

我知道有关于此的线索,但我只是没有看到我在这里做错了什么。使用以下配置,当我尝试通过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>

2 个答案:

答案 0 :(得分:1)

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

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

答案 1 :(得分:1)

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