I have Vista Business running IIS7, and on this a Web Site and also a Web Service. The Web Site uploads a file to the Web Service. When the file size goes over 20Mb, a 404 error gets returned (after about a second). In the web.config of both I have added
an entry to allow for large files:
Could you please tell me is there a setting in IIS which only allows files up to a certain size to be uploaded, or if there is a max http request length?
But Please do not edit IIS_Schema.xml, instead To add configuration sections to the schema,put them in .xml files similar to this one, in this directory. They will be picked up automatically at application pool startup.
Try increasing UploadReadAheadSize to something like "200000000".
HTH.
~ Ganesh
Please: Don't forget to click "Mark as Answer" on the post that helped you. That way future readers will know which post solved your issue.
In the Web Service, I have a web method defined which takes in the file in the form of a byte array. The web method opens a FileStream, and writes the byte array to disk. For files up to 20Mb in size, this is no problem. When the file size gets over 20Mb
roughly, a 404 error is returned when trying to access that web method.
I need to know if there is a specific setting in IIS that would produce this behaviour?
Hi again Ganesh. First off - I can't find where to set the
UploadReadAheadSize - the link on MSDN is not very helpful.
I am a bit confused. The default setting for this is 48kb right? But when I'm uploading a file as a byte array, it's fine for files up to 20Mb. What should I set the UploadReadAheadSize value to, to allow for files up to 100Mb???
I'm new to IIS, so this command is all new to me! Do I just need to replace the "My site/MyApp" section with the name of my site and run it from a command line?
Do you have another command for me to tell what the value is currently?
Instead of doing "runas /user:administrator ..." you can right click on the command prompt icon and choose "run as administrator" - the difference is that it will run it with your credentials but with admin privileges enabled.
To get settings, you can do "appcmd list config "My Site/MyApp" -section:requestFiltering" - appcmd -? or appcmd config -? or appcmd list config -? etc will give you lots of help about how to use the various appcmd commands.
Anil Ruia
Software Design Engineer
IIS Core Server
joker77
21 Posts
File Size for Uploads setting in IIS?
May 09, 2007 03:43 PM|LINK
Hi there,
Think this is my first post so bear with me!
I have Vista Business running IIS7, and on this a Web Site and also a Web Service. The Web Site uploads a file to the Web Service. When the file size goes over 20Mb, a 404 error gets returned (after about a second). In the web.config of both I have added an entry to allow for large files:
<
httpRuntime executionTimeout="3600" maxRequestLength="102400"/>Could you please tell me is there a setting in IIS which only allows files up to a certain size to be uploaded, or if there is a max http request length?
ganeshanekar
551 Posts
Re: File Size for Uploads setting in IIS?
May 10, 2007 01:53 AM|LINK
What programming logic you are implementing to upload files?
AFAIK, By default, IIS will pre-read up to 48k bytes, but it is configurable by the UploadReadAheadSize metabase setting.
It is defined in IIS_Schema.xml.
<attribute name="uploadReadAheadSize" type="uint" defaultValue="49152" validationType="integerRange" validationParameter="0,2147483647" />
But Please do not edit IIS_Schema.xml, instead To add configuration sections to the schema,put them in .xml files similar to this one, in this directory. They will be picked up automatically at application pool startup.
Try increasing UploadReadAheadSize to something like "200000000".
HTH.
~ Ganesh
joker77
21 Posts
Re: File Size for Uploads setting in IIS?
May 10, 2007 07:51 AM|LINK
Thanks Ganesh
In the Web Service, I have a web method defined which takes in the file in the form of a byte array. The web method opens a FileStream, and writes the byte array to disk. For files up to 20Mb in size, this is no problem. When the file size gets over 20Mb roughly, a 404 error is returned when trying to access that web method.
I need to know if there is a specific setting in IIS that would produce this behaviour?
ganeshanekar
551 Posts
Re: File Size for Uploads setting in IIS?
May 10, 2007 08:01 AM|LINK
If you are implementing byte array then bumping up UploadReadAheadSize value should fix this issue.
The same type of issue was documented in following KB for IIS 5.0/6.0 and AFAIK in IIS 7 this would be the same.
http://support.microsoft.com/kb/810957/en-us
HTH.
~ Ganesh
joker77
21 Posts
Re: File Size for Uploads setting in IIS?
May 10, 2007 08:25 AM|LINK
Thanks Ganesh - I'll give this a try and let you know how I get on, although is a 404 error I'm getting rather than a 400 one.
joker77
21 Posts
Re: File Size for Uploads setting in IIS?
May 10, 2007 09:34 AM|LINK
Hi again Ganesh. First off - I can't find where to set the UploadReadAheadSize - the link on MSDN is not very helpful.
I am a bit confused. The default setting for this is 48kb right? But when I'm uploading a file as a byte array, it's fine for files up to 20Mb. What should I set the UploadReadAheadSize value to, to allow for files up to 100Mb???
anilr
2343 Posts
Microsoft
Re: File Size for Uploads setting in IIS?
May 10, 2007 05:14 PM|LINK
You are probably hitting a new limit in request-filtering feature (replacement for url-scan) in IIS7. Try to set this to see if it helps
appcmd set config "My Site/MyApp" -section:requestFiltering -requestLimits.maxAllowedContentLength:104857600 -commitpath:apphost
the default for this is 30000000 (slightly less than 30MB)
Software Design Engineer
IIS Core Server
joker77
21 Posts
Re: File Size for Uploads setting in IIS?
May 11, 2007 08:19 AM|LINK
Hey anilr - thanks for your help!
I'm new to IIS, so this command is all new to me! Do I just need to replace the "My site/MyApp" section with the name of my site and run it from a command line?
Do you have another command for me to tell what the value is currently?
Thanks
joker77
21 Posts
Re: File Size for Uploads setting in IIS?
May 11, 2007 08:41 AM|LINK
Thanks again Anil - this worked!
Just in case anybody else is looking for it:
To get to appcmd.exe
Start->Run-> runas /user:Administrator cmd
cd c:\Windows\systems32\inetsrv
Then just type in Anil's command from above
anilr
2343 Posts
Microsoft
Re: File Size for Uploads setting in IIS?
May 11, 2007 12:05 PM|LINK
Instead of doing "runas /user:administrator ..." you can right click on the command prompt icon and choose "run as administrator" - the difference is that it will run it with your credentials but with admin privileges enabled.
To get settings, you can do "appcmd list config "My Site/MyApp" -section:requestFiltering" - appcmd -? or appcmd config -? or appcmd list config -? etc will give you lots of help about how to use the various appcmd commands.
Software Design Engineer
IIS Core Server