1

我有一个托管在 IIS 下的 WCF 服务,位于负载均衡器后面。SSL 在 LB 处卸载,然后以纯 HTTP 调用服务。

我让服务的 REST 端点正常工作,但似乎无法让 SOAP 端点显示 wsdl 页面。调用https://domain/Service.svc/soap?wsdl浏览器时会收到 400 Bar Request 响应。我也检查了 svclog,错误是There is a problem with the XML that was received from the network. See inner exception for more details.这意味着它希望我做一个POST而不是GET发送一个 XML。

来自配置的片段:

<bindings>
    <basicHttpBinding>
        <binding name="basicBinding" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
          <security mode="Transport"></security>
          <readerQuotas maxStringContentLength="2147483647" />
        </binding>
    </basicHttpBinding>
    <webHttpBinding>
        <binding name="webBinding" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
            <security mode="Transport"></security>
        </binding>
   </webHttpBinding>
</bindings>

<services>
    <service behaviorConfiguration="MyServiceBehavior" name="Namespace.Service">
        <endpoint address="" behaviorConfiguration="MyRESTBehavior" binding="webHttpBinding" bindingConfiguration="webBinding" name="REST" contract="Namespace.IService" />
        <endpoint address="https://domain/Service.svc/soap" binding="basicHttpBinding" bindingConfiguration="basicBinding" name="SOAP" contract="Namespace.IService" />
    </service>
</services>

<behaviors>
    <serviceBehaviors>
        <behavior name="MyServiceBehavior">
            <serviceMetadata httpGetEnabled="false" httpsGetEnabled="true"/>
            <serviceDebug includeExceptionDetailInFaults="true"/>
            <dataContractSerializer maxItemsInObjectGraph="6553600" />
        </behavior>
    </serviceBehaviors>
    <endpointBehaviors>
        <behavior name="MyRESTBehavior">
            <webHttp/>
        </behavior>
    </endpointBehaviors>
</behaviors>

我也尝试使用 wsHttpBinding 但唯一不同的结果是得到401s 。任何方向表示赞赏。

4

2 回答 2

0

我不相信您可以为 basicHttpBinding 端点使用绝对地址。试试这个:

<endpoint address="soap" binding="basicHttpBinding" bindingConfiguration=...

要访问 WSDL,您的 URL 应如下所示:“https://domain/soap/Service.svc?wsdl”。使用 IIS 和 WCF,您无法覆盖虚拟目录的 URL。端点地址值应与网站 URL 相关。

于 2011-05-10T12:58:23.400 回答
0

我找到了。我之前从 中删除了该httpsGetUrl属性,serviceMetadata因为我收到了两次发布服务的错误。我现在认为该错误可能是由于拼写错误,我不应该删除httpsGetUrl. 将部分更改为behaviors以下部分解决了我的问题:

<behaviors>
    <serviceBehaviors>
        <behavior name="MyServiceBehavior">
            <serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" httpsGetUrl="https://domain/Service.svc/soap" />
            <serviceDebug includeExceptionDetailInFaults="true"/>
            <dataContractSerializer maxItemsInObjectGraph="6553600" />
        </behavior>
    </serviceBehaviors>
    <endpointBehaviors>
        <behavior name="MyRESTBehavior">
            <webHttp/>
        </behavior>
    </endpointBehaviors>
</behaviors>
于 2011-05-16T12:56:25.060 回答