Microsoft KB Archive/925764

= Error message when a Web browser sends a request for an active server page to a Web server that is running IIS 6.0: &quot;Response buffer limit exceeded&quot; =

Article ID: 925764

Article Last Modified on 5/11/2007

-

APPLIES TO


 * Microsoft Internet Information Services 6.0

-



SYMPTOMS
Consider the following scenario. A client Web browser sends a request for an active server page (ASP) to a Web server that is running Internet Information Services (IIS) 6.0. The ASP request generates a large response. In this scenario, the following symptoms may occur:  The response fails. An HTTP 500 server error occurs, and you receive the following error message in the client Web browser:

Response object error 'ASP 0251 : 80004005'

Response Buffer Limit Exceeded

/, line

Note  represents the name of the ASP page that was requested. represents the last line number in the file that was processed before the response buffer exceeded the limit. The IIS log file contains the following error in the cs-uri-query field:


 * 0|ASP_0251_:_80004005|Response_Buffer_Limit_Exceeded





CAUSE
This issue occurs because of a change in behavior that was introduced in IIS 6.0 and added to IIS 5.0. These versions of IIS enforce a default ASP response buffer limit of 4 MB. This limit prevents large ASP responses from adversely affecting the IIS process that hosts the Web application. If an ASP request generates a response that is larger than the configured buffer limit, you experience the symptoms that are mentioned in the &quot;Symptoms&quot; section.



RESOLUTION
In most scenarios, the 4 MB buffer limit is sufficient for ASP responses that are sent to Web clients. If this limit is insufficient, use one of the following methods:

Method 1: Decrease the response size
If the response is larger than the 4 MB default value, this size frequently causes a poor user experience. The Web browser must receive the large response over the network. Then, the Web browser must parse and display a very large HTML response.

If the Web client that receives the response does not have to view the whole response as a single page, you can decrease the response size. For example, you can rewrite the ASP-based application so that data is presented in a grid. Therefore, the Web client can browse the data one page at a time. You can use the GridView class in Microsoft ASP.NET to achieve this effect. For more information about the GridView class in ASP.NET, visit the following Microsoft Developer Network (MSDN) Web site:

http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.aspx

Method 2: Use the Response.Flush method
If you use a loop in the ASP file to build a large table or construct data, you can use the Response.Flush method. When you use this method, you can still use buffering. However, you also have complete control over the amount of data that is sent to the Web client, and you can control the buffer size of the response. For more information about the Response.Flush method, visit the following MSDN Web site:

http://msdn2.microsoft.com/en-us/library/ms525560.aspx

Method 3: Disable buffering
You can disable buffering on the Web server, at the application level, or at the page level. When you disable buffering, the Web server uses HTTP chunked-transfer encoding to send the response to the Web client.

To disable buffering at the application level, you can use the AspBufferingOn IIS metabase property. For more information about the AspBufferingOn IIS metabase property, visit the following Microsoft Web site:

http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/fbe1bd5f-52d4-4a26-8ab1-7bb897bb3d53.mspx

To disable buffering at the page level, you can use the Response.Buffer property. For more information about the Response.Buffer property, visit the following MSDN Web site:

http://windowssdk.msdn.microsoft.com/en-us/library/ms526001.aspx

Method 4: Increase the buffer limit
You can increase the buffering limit if one of the following conditions is true:
 * The client is not a Web browser.
 * You cannot redesign the application to take advantage of a paging technology, such as the GridView class.

If you must increase the buffer limit, select a buffer limit that allows for the largest known response size. If you do not know the largest response size in advance, you can increase the buffer limit to a large value during testing. After you finish testing, use the largest value that is in the sc-bytes field in the IIS log file for the response that is generated for the page.

To increase the buffering limit, follow these steps:  Click Start, click Run, type cmd, and then click OK. Type the following command, and then press ENTER:

cd /d %systemdrive%\inetpub\adminscripts

 Type the following command, and then press ENTER:

cscript.exe adsutil.vbs SET w3svc/aspbufferinglimit

Note  represents the buffering limit size in bytes. For example, the number 67108864 sets the buffering limit size to 64 MB.</li></ol>

To confirm that the buffer limit is set correctly, follow these steps: <ol> Click Start, click Run, type cmd, and then click OK.</li> Type the following command, and then press ENTER:

cd /d %systemdrive%\inetpub\adminscripts

</li> Type the following command, and then press ENTER:

cscript.exe adsutil.vbs GET w3svc/aspbufferinglimit

</li></ol>

<div class="status_section">

STATUS
This behavior is by design.

<div class="moreinformation_section">

MORE INFORMATION
For more information about the AspBufferingLimit IIS metabase property, visit the following Microsoft Web site:

http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/ea7e9c3f-d0c8-4e5c-8965-0d0429a3b8f1.mspx

Keywords: kbasp kbtshoot kbprb KB925764

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.