views:

121

answers:

2

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" />
   </binding>
+1  A: 

Be aware that maxReceivedMessageSize is in Bytes whereas maxRequestLength is in KiloBytes. Also for buffered transfer set the buffer size to the same value as max message size. How large is the failing input?

Ladislav Mrnka
The failing request is hardly few kB. It is far below 1 MB, I however shall update the exact size later.
Kangkan
So, may I expect some more guidance please?
Kangkan
A: 

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">
Kangkan