远程服务器返回意外响应:(400)WCF配置中的错误请求

时间:2014-10-02 16:20:24

标签: wcf

我在IIS的网站应用程序下托管了WCF。以下是web.config中的服务声明

<system.serviceModel>
    <services>
<service  name="Emp.Depart.Handle">
        <endpoint behaviorConfiguration="HandleBehavior" binding="basicHttpBinding"
          bindingConfiguration="BasicHttpBinding_IHandle"
           contract="Emp.Depart.IHandle" />
      </service>
    </services>
<behaviors>
      <endpointBehaviors>
<behavior name="HandleBehavior">
          <dataContractSerializer maxItemsInObjectGraph="2147483647" />
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>
        <behavior name="HandleBehaviors">
          <dataContractSerializer maxItemsInObjectGraph="2147483647" />
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
          <basicHttpBinding>
    <binding name="BasicHttpBinding_IHandle" closeTimeout="00:01:00"
              openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
              allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
              maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
              transferMode="Buffered" useDefaultWebProxy="true">
              <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
                maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
              <security mode="None">
                <transport clientCredentialType="None" proxyCredentialType="None"
                  realm="" />
                <message clientCredentialType="UserName" algorithmSuite="Default" />
              </security>
            </binding>
     </basicHttpBinding>
        </bindings>
</system.serviceModel>

尽管之前的声明我得到了错误:

WCF远程服务器返回了意外响应:(400)错误请求

当尝试从客户端连接时,客户端的cofig如下:

<basicHttpBinding>
                <binding name="BasicHttpBinding_Ihl7" closeTimeout="00:01:00"
                    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:05:00"
                    allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferSize="2147483646" maxBufferPoolSize="2147483646" maxReceivedMessageSize="2147483646"
                    messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                    useDefaultWebProxy="true">
                    <readerQuotas maxDepth="2147483646" maxStringContentLength="2147483646" maxArrayLength="2147483646"
                        maxBytesPerRead="2147483646" maxNameTableCharCount="2147483646" />
                    <security mode="None">
                        <transport clientCredentialType="None" proxyCredentialType="None"
                            realm="" />
                        <message clientCredentialType="UserName" algorithmSuite="Default" />
                    </security>
                </binding>
            </basicHttpBinding>

我无法确定问题的原因,我搜索并增加了maxRecievedMessage但没有发生任何事情。

请建议。

1 个答案:

答案 0 :(得分:0)