Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

maxReceivedMessageSize and maxBufferSize in app.config

How to increase maxReceivedMessageSize and maxBufferSize parameters in app.config file to 2000000 before running the application.

like image 512
Vishal I P Avatar asked Feb 21 '13 10:02

Vishal I P


People also ask

What is MaxReceivedMessageSize in web config?

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.

What is default MaxReceivedMessageSize?

You need to set the MaxReceivedMessageSize attribute in your binding configuration. By default, it is 65536.

What is the maximum value for MaxReceivedMessageSize?

I noticed that 2147483647 seems to be a popular choice for maxReceivedMessageSize but is this the limit?

What is maxBufferSize in WCF?

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.


2 Answers

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> 
like image 58
mattytommo Avatar answered Sep 23 '22 20:09

mattytommo


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.

like image 24
Jacob Avatar answered Sep 20 '22 20:09

Jacob