Home » .Net Framework

WCF webservice: HTTP/1.1 400 Bad Request while sending large input

I am connecting to a WCF based webservice. For certain methods, the input contains a list of objects/structures. When the number of items in this list increases beyond a certain number, the service fails with HTTP/1.1 400 Bad Request when I try to test the same using SOAPUI. I tried changing the web.config file with the following changes:

<httpRuntime maxRequestLength="2097151" />

  <binding name="basicHTTP" closeTimeout="00:01:00"
    openTimeout="00:01:00" receiveTimeout="00:01:00" sendTimeout="00:01:00" maxReceivedMessageSize="4194304" maxBufferSize="98547" maxBufferPoolSize="258547">
   <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />



2 Answers Found


Answer 1

set up WCF trace on the server and see the exact error:



Answer 2

The issue was solved by the maxReceivedMessageSize setting. Initially in my binding, I did not set the bindingConfiguration explicitly, though the basicHttpBinding was declared and set. As such changes in maxReceivedMessageSize in the binding was not getting applied and the default setting of 64kb was active. I have set the bindings like:

<endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicHttpBinding"
 name="AMS" bindingName="basicHttpBinding" contract="Entity.AccuchekMobility.Service.IAccuchekMobilityService" />

  <binding name="basicHttpBinding" closeTimeout="00:01:00"
    openTimeout="00:01:00" receiveTimeout="00:02:00" sendTimeout="00:01:00" maxReceivedMessageSize="4194304" maxBufferPoolSize="524288" maxBufferSize="4194304">




<< Previous      Next >>

Microsoft   |   Windows   |   Visual Studio   |   Sharepoint   |   Azure