Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I enable upload of large files in classic ASP on IIS 7?

Recently I had to get an old ASP application working in IIS 7.5 on a W2K8 server. Almost everything works fine, except that I can't seem to get it to accept uploads larger than ~200kB. I did find a setting, that from what I can understand should to the trick, in the applicationHost.config, I set the max request size to 100 MB like this:

<location path="TheNameOfMySite">     <system.webServer>         <security>             <requestFiltering>                 <requestLimits maxAllowedContentLength="104857600" />             </requestFiltering>         </security>     </system.webServer> </location> 

Unfortunately, this seems to do nothing at all, it still refuses to accept any files larger than about 200 KB, and in the log file it gives this error message:

 ASP_0104_:_80004005|Operation_not_Allowed 

Googling that points to increasing the maxAllowedContentLength as I have done above. So I'm fresh out of ideas, but confident that the clever stackoverflow crowd can solve this in less time than it took for me to write this question.

like image 408
Johan Driessen Avatar asked Jan 01 '10 19:01

Johan Driessen


People also ask

What is max upload size IIS?

IIS limits the upload file size by default to 30000000 bytes which is approximately 28.6 MB. This can also be caused by a size restriction by the SMTP server configuration.

What is the maximum file upload size in Asp net?

Max Upload File Size in IIS and ASP.NET (. By default maximum upload size is set to 4096 KB (4 MB) by ASP.NET. To increase the upload limit add an appropriate section to your web.


2 Answers

The maxAllowedContentLength controls how much data is allowed to be sent in a response. However you want to control how much can be accepted in a request. This is handled by the maxRequestEntityAllowed attribute of the limits element in the asp section of the config file. An example might look like:-

<system.webServer>   <asp>      <cache diskTemplateCacheDirectory="%SystemDrive%\inetpub\temp\ASP Compiled Templates" />      <limits scriptTimeout="00:02:00"         queueConnectionTestTime="00:00:05"         requestQueueMax="1000"         maxRequestEntityAllowed="104857600"         />   </asp> 

You can configure this in the IIS7 manager under the "Limit Properties" category in the property grid for the ASP feature. Alternatively you can use a command line:-

appcmd set config /section:asp /limits.maxRequestEntityAllowed:104857600 

Note that extending this value increase the window for DOS attack where the attacker sends large content to the server so don't be tempted to extend this beyond what you really need.

like image 139
AnthonyWJones Avatar answered Oct 03 '22 07:10

AnthonyWJones


On Windows 2008 - Go into Administrative tools - server Manager - expand Roles - expand Webserver -click on IIS - and look for the web instance, for which you want to change the file size limit and then go into option “ASP” expand “Limit properties” and property you need to change is 'Maximum Request Entity Body Limit'. File Size is always in bytes so use any online calculator to calculate the conversion of bytes to KB or MB.

like image 33
shoaib suleman Avatar answered Oct 03 '22 06:10

shoaib suleman