How to increase maxReceivedMessageSize and maxBufferSize parameters in app.config file to 2000000 before running the application.
config file and add the MaxReceivedMessageSize property in my web. config - but where? The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element.
You need to set the MaxReceivedMessageSize attribute in your binding configuration. By default, it is 65536.
I noticed that 2147483647 seems to be a popular choice for maxReceivedMessageSize but is this the limit?
The maximum size, in bytes, of a buffer that stores messages while they are processed for an endpoint configured with this binding. The default value is 65,536 bytes.
You need to do that on your binding, but you'll need to do it on both Client and Server. Something like:
<system.serviceModel> <bindings> <basicHttpBinding> <binding maxBufferSize="64000000" maxReceivedMessageSize="64000000" /> </basicHttpBinding> </bindings> </system.serviceModel>
You can do that in your app.config. like that:
maxReceivedMessageSize="2147483647"
(The max value is Int32.MaxValue
)
Or in Code:
WSHttpBinding binding = new WSHttpBinding(); binding.Name = "MyBinding"; binding.MaxReceivedMessageSize = Int32.MaxValue;
Note:
If your service is open to the Wide world, think about security when you increase this value.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With