共用方式為


HttpTransportBindingElement.MaxBufferSize Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets or sets the maximum size of the buffer to use. 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.

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

Syntax

'Declaration
Public Property MaxBufferSize As Integer
public int MaxBufferSize { get; set; }

Property Value

Type: System.Int32
The maximum size, in bytes, of the buffer.

Remarks

For streamed messages, if the size of the message headers is greater than this property, then a QuotaExceededException is thrown. For a non-streamed message, if the message size is greater than this property, then the message is dropped.

If not specified, this defaults to 65536.

Examples

            ' Create an instance of the HttpTransportBindingElement
            Dim httpTransportBindingElement As New HttpTransportBindingElement()
            Dim txtDefaultMaxBufferSize As String = httpTransportBindingElement.MaxBufferSize.ToString()
            txtOutput1.Text = txtDefaultMaxBufferSize 'The value is 65536 (0x10000).

            ' Change the maximum buffer size.
            httpTransportBindingElement.MaxBufferSize = &H20000
            Dim txtNewMaxBufferSize As String = httpTransportBindingElement.MaxBufferSize.ToString()
            txtOutput2.Text = txtNewMaxBufferSize 'The value is 131072 (0x20000).
// Create an instance of the HttpTransportBindingElement
HttpTransportBindingElement httpTransportBindingElement = new HttpTransportBindingElement();
string txtDefaultMaxBufferSize = httpTransportBindingElement.MaxBufferSize.ToString();
txtOutput1.Text = txtDefaultMaxBufferSize;  //The value is 65536 (0x10000).

// Change the maximum buffer size.
httpTransportBindingElement.MaxBufferSize = 0x20000;
string txtNewMaxBufferSize = httpTransportBindingElement.MaxBufferSize.ToString();
txtOutput2.Text = txtNewMaxBufferSize; //The value is 131072 (0x20000).

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.