We used to have these properties in the WCF Web API configuration.
MaxBufferSize = int.MaxValue,
MaxReceivedMessageSize = int.MaxValue,
System. ServiceModel Basic Http Binding. Max Buffer Size Property System. Service Model Gets or sets the maximum size, in bytes, for a buffer that receives messages from the channel. 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.
If a message exceeds the maximum value set for the buffer, it is not dropped. Instead, more memory is requested from the CLR heap and this incurs more garbage collection overhead than using the buffers. The settings for MaxBufferSize and MaxReceivedMessageSize, are local behavioral settings.
For buffered messages this value is the same as MaxReceivedMessageSize. For streamed messages, this value is the maximum size of the SOAP headers, which must be read in buffered mode. The maximum size, in bytes, of the buffer. The following example sets this property to use when performing requests on the binding.
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. The following example sets MaxBufferSize to 1,000,000 bytes. The value of this property can also be set in the configuration file.
I solve this problem making a dynamic binding before like this
BasicHttpBinding bind = new BasicHttpBinding();
bind.OpenTimeout = bind.CloseTimeout = bind.SendTimeout = bind.ReceiveTimeout = new TimeSpan(0, 30, 0);
bind.MaxBufferSize = int.MaxValue;
bind.MaxReceivedMessageSize = int.MaxValue;
If you're self-hosting, it's part of the HttpSelfHostConfiguration class: MSDN Documentation of the HttpSelfHostConfiguration class
It would be used like this:
var config = new HttpSelfHostConfiguration(baseAddress);
config.MaxReceivedMessageSize = int.MaxValue;
config.MaxBufferSize = int.MaxValue;
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