I want to set maxReceivedMessageSize in the App.config of the WCF client.
If maxReceivedMessageSize is equal to or less than 4215, it works fine. Although, setting it to 4216 or any value above it, the default value of 65536 is accepted.


My customer code
<?xml version="1.0" encoding="utf-8" ?> <configuration> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> </startup> <system.serviceModel> <bindings> <basicHttpBinding> <binding name="BasicHttpBinding_IConexaApiServic" maxReceivedMessageSize="4216" /> </basicHttpBinding> </bindings> <client> <endpoint address="http://svsr02.conexa.local/HelloService/ConexaApiService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IConexaApiServic" contract="ConexaApiService.IConexaApiService" name="BasicHttpBinding_IConexaApiService" /> </client> </system.serviceModel> </configuration>
And the server reference code
<basicHttpBinding> <binding name="BasicHttpEndpoint_MPSAPIServic" maxReceivedMessageSize="2000000"> <security mode="TransportWithMessageCredential" /> </binding> <binding name="BasicHttpEndpoint_HelloService" receiveTimeout="00:10:00" sendTimeout="00:10:00" maxReceivedMessageSize="2000000"> </binding> </basicHttpBinding> <service name="IIS_test123.HelloService"> <endpoint address="ConexaApi" binding="basicHttpBinding" bindingConfiguration="BasicHttpEndpoint_HelloService" contract="IIS_test123.IHelloService"></endpoint> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> <host> <baseAddresses> <add baseAddress="http://localhost:8733/API/ConexaApiService" /> </baseAddresses> </host> </service> </services>
Any idea how to fix this?
source share