Discussion:
Adodb.Stream problems on IIS6
(too old to reply)
Craig Flannigan
2004-08-09 11:32:12 UTC
Permalink
Hi,

I've recently moved to IIS 6.0 after being on II5.

I've got an application which is basically a File store that keeps
nearly 1000 files secure yet allows users to download them. To keep it
secure, we don't show the actual file path on the URL to the file.

e.g: http://www.abc.com/downloadfile.asp?ID=34356


We have a page called Download.asp which opens the file, streams it with
ADODB.Stream to the browser and all is fine.

This works on IIS 5 without problem, but since moving to IIS 6 we cannot
download files over 4MB.


I've changed a setting in the Metabase.xml file ("ASPBufferingLimit") to
a much higher value but nothing is working and I'm now losing hair as
users are complaining!


The code works fine, but it appears IIS limits the Response Buffer.
I'm stuck - I've changed the settings I thought would cure it, but
nothing is helping.

This also affects the uploading of these files too - which is now much
slower.

Has anyone got any advice?


Kind regards
Craig

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
David Wang [Msft]
2004-08-10 04:01:05 UTC
Permalink
ASP has both upload and download limits on entity body. The default values
are global.

In general, it is bad idea to have a buffered response that is large (it can
lead to a DoS on your server -- for example, one ASP script in an infinite
loop with a buffered response will DoS memory on your server). This is why
IIS6 limited the default to 4MB -- reality should be much smaller. If you
are sending large entity, you should consider setting "Response.Buffer =
false".


If you changed metabase.xml but do not have "Edit while running" enabled,
then the change is absolutely ignored. According to documentation, you can
either:
1. Stop IIS, change metabase.xml, restart IIS
2. Enable "Edit While Running" in the IIS Manager UI at the Computer level,
then edit metabase.xml directly
3. Use administration API to make dynamic change to the metabase. i.e.
ADSUTIL.VBS SET W3SVC/AspBufferingLimit 1000000000

In general, if you just change metabase.xml without telling IIS about it,
the change will be ignored. Edit while running tells IIS to listen for your
changes. Administration API directly tells IIS the changes.


Uploads are affected by a similar property, AspMaxRequestEntityAllowed,
which is only 200K by default.
--
//David
IIS
This posting is provided "AS IS" with no warranties, and confers no rights.
//
"Craig Flannigan" <***@kingfieldheath.com> wrote in message news:%***@tk2msftngp13.phx.gbl...
Hi,

I've recently moved to IIS 6.0 after being on II5.

I've got an application which is basically a File store that keeps
nearly 1000 files secure yet allows users to download them. To keep it
secure, we don't show the actual file path on the URL to the file.

e.g: http://www.abc.com/downloadfile.asp?ID=34356


We have a page called Download.asp which opens the file, streams it with
ADODB.Stream to the browser and all is fine.

This works on IIS 5 without problem, but since moving to IIS 6 we cannot
download files over 4MB.


I've changed a setting in the Metabase.xml file ("ASPBufferingLimit") to
a much higher value but nothing is working and I'm now losing hair as
users are complaining!


The code works fine, but it appears IIS limits the Response Buffer.
I'm stuck - I've changed the settings I thought would cure it, but
nothing is helping.

This also affects the uploading of these files too - which is now much
slower.

Has anyone got any advice?


Kind regards
Craig

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Craig Flannigan
2004-08-10 09:22:00 UTC
Permalink
Thanks for your reply David.

I'd already put IIS into Edit while running mode, altered the
ASPBufferingLimit to a much higher value (about 1GB) and saved the file
- but nothing changed.

I've even rebooted the server and it's not taken up the new effect - we
also put Response.Buffer=False into the code but nothing changed. I've
added the code below - should I have done something wrong.

This application is on an Intranet so I'm not too worried about
increasing these limits.

My concern is they appear to do nothing.

If I download a 12MB file, that's no problem since I upped the
ASPBuffering limit. However, I cannot download a 20MB file or higher.

The ASPBufferingLimit is set to "1029730432"

(Although raising this appears to do nothing.)

Anything over 20MB gives me "This page cannot be displayed ..." Error.

If you can shed any light on this, I'd be really grateful.


Regards
Craig.




Here is my code, should it help:

--------------------

Response.Buffer = False
[ DATABASE CODE HERE TO OBTAIN FILENAME ]



'--- Get File Size Details -------------
dim fs, f
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.GetFile("E:\wwwroot\Intranet\Toolkit\Store\"" &
strRealFilename)
strSize = F.Size
set FS=nothing




'--- Server Folder Root ----------------------------------------
Dim strServerFolderRoot
strServerFolderRoot = "E:\wwwroot\Intranet\Toolkit\Store\"

Dim sFileName
sFileName = strRealFilename

Dim sFullFileName
sFullFileName = strServerFolderRoot & strRealFilename

Response.Contenttype="application/x-unknown"
Response.Addheader "Content-Disposition", "attachment; filename=" &
chr(34) & sFileName & chr(34)
Response.AddHeader "Content-Length", strSize

Response.Binarywrite GetBinaryFile(sFullFileName)
Response.Flush


Function GetBinaryFile(ByVal sFileSpec)
Const adTypeBinary = 1
Dim objStream
Set objStream = Server.Createobject("ADODB.Stream")
objStream.Open
objStream.Type = adTypeBinary
objStream.LoadFromFile sFileSpec
GetBinaryFile = objStream.read
Set objStream = Nothing
End Function
%>


--------------------


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
David Wang [Msft]
2004-08-10 21:28:48 UTC
Permalink
Let me clarify several concepts:

ASPBufferingLimit is new on IIS6 and controls the size of the ASP response
buffer, should you use Response.Buffer=true

Response.Buffer controls whether HTTP response is sent all at once in a
buffer, or in multiple chunks as they are sent -- the browser is going to
show the same thing. However, when "Response.Buffer=false",
ASPBufferingLimit is no longer in effect (since there's no buffering on the
server).

If you can download a 12MB file with Response.Buffer=true , then your
changes must have taken effect (since the default value is 4MB).

I don't know why it's not working in your 20MB+ case. Can you check your
HTTPERR log to see if anything unusual is there?
--
//David
IIS
This posting is provided "AS IS" with no warranties, and confers no rights.
//
"Craig Flannigan" <***@kingfieldheath.com> wrote in message news:OSr4%***@tk2msftngp13.phx.gbl...
Thanks for your reply David.

I'd already put IIS into Edit while running mode, altered the
ASPBufferingLimit to a much higher value (about 1GB) and saved the file
- but nothing changed.

I've even rebooted the server and it's not taken up the new effect - we
also put Response.Buffer=False into the code but nothing changed. I've
added the code below - should I have done something wrong.

This application is on an Intranet so I'm not too worried about
increasing these limits.

My concern is they appear to do nothing.

If I download a 12MB file, that's no problem since I upped the
ASPBuffering limit. However, I cannot download a 20MB file or higher.

The ASPBufferingLimit is set to "1029730432"

(Although raising this appears to do nothing.)

Anything over 20MB gives me "This page cannot be displayed ..." Error.

If you can shed any light on this, I'd be really grateful.


Regards
Craig.




Here is my code, should it help:

--------------------

Response.Buffer = False
[ DATABASE CODE HERE TO OBTAIN FILENAME ]



'--- Get File Size Details -------------
dim fs, f
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.GetFile("E:\wwwroot\Intranet\Toolkit\Store\"" &
strRealFilename)
strSize = F.Size
set FS=nothing




'--- Server Folder Root ----------------------------------------
Dim strServerFolderRoot
strServerFolderRoot = "E:\wwwroot\Intranet\Toolkit\Store\"

Dim sFileName
sFileName = strRealFilename

Dim sFullFileName
sFullFileName = strServerFolderRoot & strRealFilename

Response.Contenttype="application/x-unknown"
Response.Addheader "Content-Disposition", "attachment; filename=" &
chr(34) & sFileName & chr(34)
Response.AddHeader "Content-Length", strSize

Response.Binarywrite GetBinaryFile(sFullFileName)
Response.Flush


Function GetBinaryFile(ByVal sFileSpec)
Const adTypeBinary = 1
Dim objStream
Set objStream = Server.Createobject("ADODB.Stream")
objStream.Open
objStream.Type = adTypeBinary
objStream.LoadFromFile sFileSpec
GetBinaryFile = objStream.read
Set objStream = Nothing
End Function
%>


--------------------


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Craig Flannigan
2004-08-11 10:21:52 UTC
Permalink
Hi,

Had a look in HTTPErr.log - and apart from loads of
"Timer_ConnectionIdle" messages, the only other thing that appears now
and again is "Timer_MinBytesPerSecond".

Nothing relates to my problem.

This morning I tried downloading a 12.2MB file - it failed. No matter
what setting Response.Buffer is set to, it appears to make no difference
with the larger files.

I sometimes get the "Getting File Information" box from IE when it's
normally calculating the download size of a file - but this just hangs
until I click cancel.

I'm not sure if this makes a difference, but when I download a file the
filename of the downloader script "download.asp" is replaced by the
filename (intended), but on the larger files this doesn't happen.

When downloading a 15mb file, the Filename that appears in the IE
Download Dialog box says:

"Download.asp?ID=2452345" rather than "LatestPrices.xls" as it should
do.

Any other pointers?

Thanks for your time so far. Much appreciated.

Craig.



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
David Wang [Msft]
2004-08-13 04:42:41 UTC
Permalink
When you see the problem on download/upload, please check:
%systemroot%\system32\LogFiles\HTTPErr\HTTPERR.*Log

For any related entries.

IIS6 moved from using Winsock to using HTTP.SYS (kernel mode driver), and
HTTP.SYS has introduced some growing pains from being very careful with
memory/network usage. They've fixed several issues related to
upload/download hanging, and it'd help to know what errors you see in the
HTTPErr.log and the exact request you sent to trigger it.

For example, to prevent dribble attacks, where an attacker makes a
legitimate connection to send say 100MB, and then sends only 1 byte every
second (so the connection stays "valid" but will be open for a very long
time) -- and then sends thousands of such connections to the server (which
all look legitimate and takes very little client-side bandwidth, but it can
suck up server side processing bandwidth), Timer_MinBytesPerSecond and
Timer_ConnectionIdle configuration was introduced.

Unfortunately, it also introduces some false-positives. This is unlike IIS5
on Winsock, which has no such consciousness of security -- so everything
tended to "just work" on IIS5, including attacks/vulnerabilities. Of
course, we want all your legitimate cases to work while automatically
keeping the bad-guys at bay with IIS6, so we appreciate any support you can
give.

See this URL for explanation of HTTPErr log entries:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/http/http/types_of_errors_logged_by_the_http_api.asp
--
//David
IIS
This posting is provided "AS IS" with no warranties, and confers no rights.
//
"Sam Kim" <Sam ***@discussions.microsoft.com> wrote in message news:B9BB803C-1898-4DF9-AF84-***@microsoft.com...
I'm also experiencing this problem. After changing the ASPBufferLimit to
40MB, I was able to download up to about a 20MB file but anything larger
than
that errors out. I've searched for about a week all over the web to figure
out how to remedy this but have found nothing else. I have customers that
need to use my website to download large files, about 50 MBs and since using
IIS 6.0, it's been a real problem.

-Sam
Post by Craig Flannigan
Hi,
Had a look in HTTPErr.log - and apart from loads of
"Timer_ConnectionIdle" messages, the only other thing that appears now
and again is "Timer_MinBytesPerSecond".
Nothing relates to my problem.
This morning I tried downloading a 12.2MB file - it failed. No matter
what setting Response.Buffer is set to, it appears to make no difference
with the larger files.
I sometimes get the "Getting File Information" box from IE when it's
normally calculating the download size of a file - but this just hangs
until I click cancel.
I'm not sure if this makes a difference, but when I download a file the
filename of the downloader script "download.asp" is replaced by the
filename (intended), but on the larger files this doesn't happen.
When downloading a 15mb file, the Filename that appears in the IE
"Download.asp?ID=2452345" rather than "LatestPrices.xls" as it should
do.
Any other pointers?
Thanks for your time so far. Much appreciated.
Craig.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Craig Flannigan
2004-08-13 08:41:50 UTC
Permalink
I ran some tests - where the files wouldn't download and nothing at all
appeared in the HTTPErr logfile.

I've altered the ASPBuffering Limit and it doesn't appear to have a
direct link to the amount of data I can download. Setting it to 1GB
allows a 8MB file to download (nothing more), up this to 2GB and I can
take a 10MB file.


The system is out-of-the-box, with nothing else added. We've removed
ASP.net as we thought this was messing with JET (before we patched this)
and we're only using Classic ASP at this moment.

This issue is now getting serious and we're preparing to roll-back to
Windows 2000 as this issue is causing massive problems.

Is there another way to offer downloads, while not using a standard
hyperlink directly to the file? We don't want users either guesssing the
filenames, and we don't want files opening up in the browser - we'd
rather it all downloaded to the PC.

Can this be done another way?

Is there any settings I'm missing that's causing this?


I'd attach my HTTPErr log if you require this, but it doesn't show
anything other than Idles, connection dropped and minbytespersecond. And
none of these occur at the time I attempt my downloads.

I hope you can offer any other advice. I really don't want to roll back
to Windows 2000, but this looks like my only option to get this service
working again.


Regards
Craig.




*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
ajsmith02
2004-10-12 15:21:03 UTC
Permalink
Craig, I'm having a similar problem. Did you ever resolve yours? I uses
iisstate to try and log the error and IIS6 seems to be hanging as a result of
trying to load mlang.dll.
Post by Craig Flannigan
I ran some tests - where the files wouldn't download and nothing at all
appeared in the HTTPErr logfile.
I've altered the ASPBuffering Limit and it doesn't appear to have a
direct link to the amount of data I can download. Setting it to 1GB
allows a 8MB file to download (nothing more), up this to 2GB and I can
take a 10MB file.
The system is out-of-the-box, with nothing else added. We've removed
ASP.net as we thought this was messing with JET (before we patched this)
and we're only using Classic ASP at this moment.
This issue is now getting serious and we're preparing to roll-back to
Windows 2000 as this issue is causing massive problems.
Is there another way to offer downloads, while not using a standard
hyperlink directly to the file? We don't want users either guesssing the
filenames, and we don't want files opening up in the browser - we'd
rather it all downloaded to the PC.
Can this be done another way?
Is there any settings I'm missing that's causing this?
I'd attach my HTTPErr log if you require this, but it doesn't show
anything other than Idles, connection dropped and minbytespersecond. And
none of these occur at the time I attempt my downloads.
I hope you can offer any other advice. I really don't want to roll back
to Windows 2000, but this looks like my only option to get this service
working again.
Regards
Craig.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Hakan N
2004-12-21 08:31:01 UTC
Permalink
Im having the same problem, have searched for a sollution but the only thing
we found was a work around by doing a response.flush every lets say 10k of
data but that really slows things down. Is there a real sollution for this
problem?

/Hakan
Post by Craig Flannigan
I ran some tests - where the files wouldn't download and nothing at all
appeared in the HTTPErr logfile.
I've altered the ASPBuffering Limit and it doesn't appear to have a
direct link to the amount of data I can download. Setting it to 1GB
allows a 8MB file to download (nothing more), up this to 2GB and I can
take a 10MB file.
The system is out-of-the-box, with nothing else added. We've removed
ASP.net as we thought this was messing with JET (before we patched this)
and we're only using Classic ASP at this moment.
This issue is now getting serious and we're preparing to roll-back to
Windows 2000 as this issue is causing massive problems.
Is there another way to offer downloads, while not using a standard
hyperlink directly to the file? We don't want users either guesssing the
filenames, and we don't want files opening up in the browser - we'd
rather it all downloaded to the PC.
Can this be done another way?
Is there any settings I'm missing that's causing this?
I'd attach my HTTPErr log if you require this, but it doesn't show
anything other than Idles, connection dropped and minbytespersecond. And
none of these occur at the time I attempt my downloads.
I hope you can offer any other advice. I really don't want to roll back
to Windows 2000, but this looks like my only option to get this service
working again.
Regards
Craig.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
klippe
2005-12-08 12:00:26 UTC
Permalink
I also have this problem and have tried all the usual metabase tricks
but to no avail.

Has anyone else got any ideas, I'm at my whits end.....

Clif

--
klipp
-----------------------------------------------------------------------
klippe's Profile: http://www.highdots.com/forums/m153
View this thread: http://www.highdots.com/forums/t68574

Loading...