【问题标题】:SOAP endpoint over HTTPS returns 400 Bad Request通过 HTTPS 的 SOAP 端点返回 400 Bad Request
【发布时间】:2011-05-10 08:22:34
【问题描述】:

我有一个托管在 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。任何方向表示赞赏。

【问题讨论】:

    标签: wcf soap https endpoint bad-request


    【解决方案1】:

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

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

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

    【讨论】:

      【解决方案2】:

      我找到了。我之前从serviceMetadata 中删除了httpsGetUrl 属性,因为我收到了两次发布服务的错误。我现在认为该错误可能是由于拼写错误,我不应该删除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>
      

      【讨论】:

        猜你喜欢
        • 2014-04-07
        • 2020-11-01
        • 1970-01-01
        • 2017-11-30
        • 1970-01-01
        • 1970-01-01
        • 2013-01-29
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多