Gets or sets the maximum size for a buffer that receives messages from the channel.
Assembly: System.ServiceModel (in System.ServiceModel.dll)
If there is not sufficient memory in the buffer to store the message while it is processed, more memory must be allocated from the CLR heap, which increases the garbage collection overhead. Extensive allocation from the CLR garbage heap is an indication that the message buffer size is too small and that performance can be improved with a larger allocation.
The value of the property and its significance is different depending on whether the messages are being buffered or streamed on the channel through which they are being received:
For streamed transports, (TransferMode set to Streamed), only the SOAP headers must be buffered to generate the message. The body can be streamed in on-demand. In this case, is less than or equal to MaxReceivedMessageSize, where MaxReceivedMessageSize bounds the size of the overall message (headers and body) and bounds only the size of the SOAP headers.
The limitations on buffer size set here are for optimizing the performance of message exchanges. 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 and MaxReceivedMessageSize, are local behavioral settings. This means that they are not transmitted to other endpoints in metadata. If you generate a proxy to a service with a maximum message size of 2GB from metadata, the proxy still has a default value of 64K. This leaves control of the appropriate bounds for message and message buffer size in the scope of local administrators.
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.