Microsoft Knowledge Base Email Alertz

KBAlertz.com: Error message when you use the Response.BinaryWrite method in IIS 6 and in IIS 7: HTTP 500 or Response buffer limit exceeded

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]

Search KbAlertz

Advanced Search

Webmasters
Put kbAlertz on your website.
[ Click Here for more! ]





ASP.NET 3.5 Web Hosting with Windows 2008 and SQL 2008: Click Here!
Discount ASP.NET Hosting
ASP.NET 2.0 and 3.5
Windows2008 and SQL2008
US and UK Hosting
The ad says 3 - but KBAlertz referrals get
** SIX MONTHS FREE **


Bug Tracking Software
For bug tracking software or defect tracking software or issue tracking software, visit Axosoft.


Community Site



We Send hundreds of thousands of emails using ASP.NET Email



Expert Web Design & Graphic Design
Design44.com

ASP.NET 3.5 Web Hosting with Windows 2008 and SQL 2008: Click Here!
Discount ASP.NET Hosting
ASP.NET 2.0 and 3.5
Windows2008 and SQL2008
US and UK Hosting
The ad says 3 - but KBAlertz referrals get
** SIX MONTHS FREE **




Mentioned In








Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks




Article ID: 944886 - Last Review: November 15, 2007 - Revision: 1.1

Error message when you use the Response.BinaryWrite method in IIS 6 and in IIS 7: "HTTP 500" or "Response buffer limit exceeded"

On This Page

SYMPTOMS

When you send a file to a client computer from a Web server on which Internet Information Services (IIS) 7 or IIS 6 is installed, you may receive an error message on the client computer that resembles one the following:
Error message 1
HTTP 500 - Internal Server Error
Error message 2
Response object error 'ASP 0251 : 80004005'
Response Buffer Limit Exceeded
Execution of the ASP page caused the Response Buffer to exceed its configured limit.
Error message 1
Additionally, you may receive a message in the IIS log file that resembles the following:
ASP_0251_:_80004005|Response_Buffer_Limit_Exceeded
This problem occurs when you use the Response.BinaryWrite method to send the file to the client computer and the AspBufferingOn property is set to False.

CAUSE

This problem occurs because IIS enforces a default Active Server Pages (ASP) response buffer value of 4 MB when ASP response buffering is disabled.

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

To resolve this issue when you use the Response.BinaryWrite method and ASP buffering is turned off, verify that the data that is returned to the client is not larger than 4 MB.

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.

Method 2: Enable ASP response buffering, and increase the buffer limit

In IIS 6, you can use the AspBufferingOn IIS metabase property to enable or disable buffering at the application level. 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 (http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/fbe1bd5f-52d4-4a26-8ab1-7bb897bb3d53.mspx)
Note In IIS 7, you can enable or disable ASP response buffering at the application level by using the bufferingOn value in the ASP section of <System.webserver> in the ApplicationHost.config file or in the Web.config file.

To enable or 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 (http://windowssdk.msdn.microsoft.com/en-us/library/ms526001.aspx)
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 appears in the sc-bytes field in the IIS log file for the response that is generated for the page.

To increase the buffering limit in IIS 6, follow these steps:
  1. Click Start, click Run, type cmd, and then click OK.
  2. Type the following command, and then press ENTER:
    cd /d %systemdrive%\inetpub\adminscripts
  3. Type the following command, and then press ENTER:
    cscript.exe adsutil.vbs SET w3svc/aspbufferinglimit LimitSize
    Note LimitSize represents the buffering limit size in bytes. For example, the number 67108864 sets the buffering limit size to 64 MB.
To confirm that the buffer limit is set correctly, follow these steps:
  1. Click Start, click Run, type cmd, and then click OK.
  2. Type the following command, and then press ENTER:
    cd /d %systemdrive%\inetpub\adminscripts
  3. Type the following command, and then press ENTER:
    cscript.exe adsutil.vbs GET w3svc/aspbufferinglimit

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section.

MORE INFORMATION

When you use the Response.BinaryWrite method and ASP response buffering is disabled, you can only send 4 MB of data to the client unless the buffering limit property for the page is explicitly set. By default, the value for the ASPBufferLimit property in IIS 6 and for the bufferLimit property in IIS 7 is 4,194,304 bytes.

Additionally, the BinaryWrite() API fails if the response to the client is larger than the buffer limit value even though ASP response buffering is turned off.

Note We recommend that you enable ASP response buffering. ASP response buffering increases the performance of a Web application.

APPLIES TO
  • Microsoft Internet Information Services 7.0
  • Microsoft Internet Information Services 6.0
Keywords: 
kbtshoot kbprb KB944886
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate

Kevin A. Report As Irrelevant  
Written: 11/11/2008 7:09 AM
Thanks, that helped alot.

(Optional) Name

(Optional) Public URL Or Email

Comments
No HTML -- Text Only Please