Client side configuration settings
I have a Windows application that calls a WCF service to generate a specific url.
A WCF function called from a Windows application accepts location data as an array.
I am facing an issue where the size of the array sent to the WCF function is small (for example 10), then the service returns the correct result.
But when the size of the array grows (for example,> 200), then the service returns 400 Bad requests.
I'm not sure if the reason for this is the size of the array or the contents of the array.
I tried changing the server (service) side of the web.config to accept the maximum buffer size.
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IServiceContract" 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="524288" maxReceivedMessageSize="2147483647" messageEncoding="Text"
textEncoding="utf-8" 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.web>
<compilation debug="true" targetFramework="4.0" />
<httpRuntime executionTimeout="90" maxRequestLength="1048576" useFullyQualifiedRedirectUrl="false"
minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="100" />
</system.web>
However, I faced the same problem.
On the client side (Windows app here) how can we set configuration options so that the client can send big data to the server?
source to share
You need to increase the read quota in the server config file as well as the client config file.
<readerQuotas maxDepth="2147483647"
maxStringContentLength="2147483647"
maxArrayLength="2147483647"
maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
And maxReceivedMessageSize and bufferSize:
<httpTransport transferMode="Buffered"
maxReceivedMessageSize="2147483647"
maxBufferSize="2147483647"/>
You may also need to add dataContractSerializer to your service behavior.
<serviceBehaviors>
<behavior name="Your SB">
<serviceMetadata httpGetEnabled="True"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
<serviceDebug
includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
source to share