Response Buffer Limit Exceeded

R

Ron Hinds

I'm getting this in an ASP application on IIS6/W2K3. The page in question is
trying to return a XML file approximately 45MB in size. Changing this is not
an option. Worked fine on IIS5/W2K. I tried Response.Buffer = False, no joy.
So I searched on MSDN and found instructions for increasing the
AspBufferingLimit property in the metabase. I increased it to 100MB for that
web application, stopped and restarted that web application, still same
result.

I ran into a similar problem on the same web app in two pages where we are
trying to receive a file of approx. 10MB in size. I was told to set the
AspMaxRequestEntityAllowed property in the metabase for the specific pages.
I set it to 16MB for each - they still don't work, either. How can I make my
legacy app work in IIS6?
 
A

Anthony Jones

Ron Hinds said:
I'm getting this in an ASP application on IIS6/W2K3. The page in question
is trying to return a XML file approximately 45MB in size. Changing this
is not an option. Worked fine on IIS5/W2K. I tried Response.Buffer =
False, no joy. So I searched on MSDN and found instructions for increasing
the AspBufferingLimit property in the metabase. I increased it to 100MB
for that web application, stopped and restarted that web application,
still same result.

I ran into a similar problem on the same web app in two pages where we are
trying to receive a file of approx. 10MB in size. I was told to set the
AspMaxRequestEntityAllowed property in the metabase for the specific
pages. I set it to 16MB for each - they still don't work, either. How can
I make my legacy app work in IIS6?

Perhaps you can describe exactly how you went about making those setting
changes because they are exactly the right ones to correct your problem(s).
 
D

Daniel Crichton

Ron wrote on Wed, 19 Nov 2008 13:07:33 -0800:
I'm getting this in an ASP application on IIS6/W2K3. The page in
question is trying to return a XML file approximately 45MB in size.
Changing this is not an option. Worked fine on IIS5/W2K. I tried
Response.Buffer = False, no joy. So I searched on MSDN and found
instructions for increasing the AspBufferingLimit property in the
metabase. I increased it to 100MB for
that web application, stopped and restarted that web application,
still same result.
I ran into a similar problem on the same web app in two pages where we
are trying to receive a file of approx. 10MB in size. I was told to
set the AspMaxRequestEntityAllowed property in the metabase for the
specific
pages. I set it to 16MB for each - they still don't work, either. How can
I
make my legacy app work in IIS6?


I wouldn't go messing with the settings - instead, chunk out the XML file in
small pieces. If this XML is coming from a file then you could use an ADO
Stream object to do this quite simply. Even turning off the buffering
doesn't help if you try to send a large file all in one go.

AspMaxRequestEntityAllowed is for incoming data to the server, not for
outgoing data - the clue is in the property name which contains the word
Request. The value you would need to change is AspBufferLimit, eg.

cscript.exe adsutil.vbs SET w3svc/aspbufferinglimit 104857600

will increase the limit to 100MB. However, I would strongly recommend
against this as it makes your application reliant on that setting. What
happens when you want to push out a 250MB file, or a 500MB, or even bigger.
Instead of adjusting that to suit your app, make your app send the file out
in pieces.

Here's some code that works on my site:


Set oStream = Server.CreateObject("ADODB.Stream")
Call oStream.Open()
oStream.Type = 1
call oStream.LoadFromFile(strDir & strFilename)

Response.ContentType = "application/octet-stream"
Response.AddHeader "Content-Disposition", "filename=" &
strFilename & ";"
Response.AddHeader "Content-Length", oStream.Size

Response.Buffer = False

'stream out the file in chunks
Do While Not (oStream.EOS)
Response.BinaryWrite oStream.Read(1024 * 256)
Loop

oStream.Close
Set oStream = Nothing

Response.End


strDir and strFilename are variables holding the directory and the filename
that is to be sent respectively.

This sets the ContentType and filename in the headers, and it's total length
so that the browser download dialog can show the user a progress percentage
if supported. Buffering is then turned off (it's on by default for the
server and this site too). It then reads 256kB at a time and sends it to the
browser - sending in small chunks with buffering off automatically clears
the buffer after each BinaryWrite call. So far it's worked well on all the
files I've delivered from my application, although they have been reasonably
small (up to around 35MB) but with the default 4MB limit of IIS6.
 
R

Ron Hinds

Anthony Jones said:
Perhaps you can describe exactly how you went about making those setting
changes because they are exactly the right ones to correct your
problem(s).

Sorry it took so long to get back to you! OK, here is what I did:

1. In IIS Manager, locate the file in question, right-click, go to
Properties, HTTP Headers, check Enable content expiration, click Apply,
un-check Enable content expiration (this creates the file in the metabase
treeview)

2. Start Metabase Explorer. Locate the web app, then the file. Right-click
and add new DWORD record. Make the record name AspBufferingLimit. Click OK.

3. Double-click the new record. On the value tab, enter 10485760 (10MB for
example). On the General tab, set User Type to File and Attributes to
Inheritable. Those last two weren't in the original instructions I got from
Microsoft but I added them afterward since it didn't work the first time.

4. Stop and restart the web application.

If there is something I am missing, please let me know. Thank you!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,782
Latest member
ThomasGex

Latest Threads

Top