NetNamedPipeBindingElement.MaxBufferSize 属性


获取或设置一个值,该值指定内存中用于存储消息的缓冲区的最大大小(以字节为单位)。Gets or sets a value that specifies the maximum size, in bytes, of the buffer used to store messages in memory.

 property int MaxBufferSize { int get(); void set(int value); };
[System.Configuration.ConfigurationProperty("maxBufferSize", DefaultValue=Mono.Cecil.CustomAttributeArgument)]
public int MaxBufferSize { get; set; }
member this.MaxBufferSize : int with get, set
Public Property MaxBufferSize As Integer


内存中用于对传入消息进行缓冲的最大字节数。The maximum number of bytes that are used to buffer incoming messages in memory. 默认值为 65,536 字节。The default value is 65,536 bytes.



此属性仅适用于经过流处理的消息的标头。This property only applies to the headers of streamed messages. 此值最少应为以缓冲模式读取的 SOAP 标头的最大可能大小。This value should be at least the maximum possible size of the SOAP headers, which are read in buffered mode.

如果缓冲区已满,则多余的数据会保留在基础套接字中,直到缓冲区重新具有可用空间。If the buffer is full, excess data remains in the underlying socket until the buffer has space again.

此属性的值必须小于或等于 MaxMessageSize,且必须大于消息头的大小,否则通道会引发异常。The value of this property must be less than or equal to MaxMessageSize and must be larger than the size of the headers of the message or the channel throws an exception.

如果接收的数据量大于可缓冲的数据量,则通道会引发 CommunicationException,该异常包含 QuotaExceededException 作为内部异常。If you receive more data than you can buffer, the channel throws a CommunicationException, which contains QuotaExceededException as an inner exception.