I noticed that 2147483647 seems to be a popular choice for maxReceivedMessageSize but is this the limit?
Asked
Active
Viewed 8.4k times
40
-
4On the other hand, you might want to consider that setting it to 2 GB of message size means your WCF server will potentially have to deal with several messages of up to 2 GB in size simultaneously - can it do that?? Marc – marc_s Jun 17 '09 at 04:49
-
1It is if you have a 32bit server... – Chad Aug 10 '17 at 18:50
3 Answers
43
Nope, the limit is Int64.MaxValue1 which is: 9223372036854775807

Robert MacLean
- 38,975
- 25
- 98
- 152

AgileJon
- 53,070
- 5
- 41
- 38
-
7In the web.config-File, only the Int32-limit seems to work. Maybe it's a parsing issue. – marsze Sep 17 '15 at 11:52
-
1When setting this value through code I get `ArgumentOutOfRange` exception for this parameter. – BartoszKP Nov 01 '16 at 23:29
9
MaxMessageReceivedSize in basicHttpBinding appears to be an int32 - setting it over the max value of an int32 results in:
This factory buffers messages, so the message sizes must be in the range of an integer value. Parameter name: bindingElement.MaxReceivedMessageSize

AndySw
- 341
- 2
- 7
-
Nope, it's Int64 (long): http://msdn.microsoft.com/en-us/library/system.servicemodel.basichttpbinding.maxreceivedmessagesize%28v=vs.100%29.ASPX – Darren Griffith Jun 11 '14 at 17:45
3
MaxReceivedMessageSize
and MaxBufferSize
must same value and MaxBufferSize
is Int32
.

Muhammad Hani
- 8,476
- 5
- 29
- 44

fernando
- 67
- 3
-
10Not true - MaxBufferSize is only used if you are using Buffering. If you are using Streaming, then it is ignored. This is why MaxReceivedMessageSize is Int64 and can be different to MaxBufferSize. – Robert MacLean Feb 26 '13 at 10:44
-
-
BasicHttpBinding MaxBufferSize is Int32, but MaxReceivedMessageSize is Int64. http://msdn.microsoft.com/en-us/library/system.servicemodel.basichttpbinding.maxbuffersize%28v=vs.100%29.aspx – Darren Griffith Jun 11 '14 at 17:47