This documentation is archived and is not being maintained.

BinaryMessageEncodingBindingElement.MaxSessionSize Property

Gets or sets the maximum amount of memory available within a session for optimizing transmission procedures.

Namespace:  System.ServiceModel.Channels
Assembly:  System.ServiceModel (in System.ServiceModel.dll)

public int MaxSessionSize { get; set; }

Property Value

Type: System.Int32
The maximum size, in bytes, of a session. The default value is 2048 bytes.


The value is less than or equal to zero.

The .NET Binary Format for XML can optimize the transmission of strings when they are used in multiple messages within a session. Once a string is sent in a message, additional messages that contain that string can refer to it using only the string's ID. This requires that the strings and their IDs be stored in memory. This allows the ID to be retransmitted in subsequent messages instead of the entire string. This lookup increases the efficiency of message transmission when using the binary format. The MaxSessionSize gets and sets the maximum amount of memory that is allocated to store these strings.

be.MaxSessionSize = 2048;

.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.