Tag Archive | "File upload"

Tags:

ASP.NET file upload exceeds the request content length


In IIS7 environment, there are several limit for ASP.NET can be override by web.config. One of error could be follow:
The request filtering module is configured to deny a request that exceeds the request content length

This problem occurs because by default in IIS 7 enabled requestFiltering that have MaxAllowedContentLength property. It specifies, in bytes, the maximum length of content in a request. The default is 30000000 (approximately 30 megabytes.)

To override the default setting, you could add following to web.config:

<configuration>
   <system.webServer>
      <security>
         <requestFiltering>
            <requestLimits maxAllowedContentLength="100000000"/> 
         </requestFiltering>
      </security>
   </system.webServer>
</configuration>

refer to:
http://www.element-it.com/RequestFilteringModule-maxAllowedContentLength.aspx

Notice above situation only occur on IIS7 or Windows 2008
———————————–

Regarding asp.net upload size limit, there are other limits like executionTimeout & maxRequestLength. If file upload larger then the limit, "Maximum request length exceeded. " error will be shown.

You can add to the site web.config like follow:
<httpRuntime executionTimeout="seconds"
             maxRequestLength="kbytes"
             minFreeThreads="numberOfThreads"
             minLocalRequestFreeThreads="numberOfThreads"
             appRequestQueueLimit="numberOfRequests"
             useFullyQualifiedRedirectUrl="true|false"  />

ref:
http://www.devx.com/vb2themax/Tip/18803
http://aspnetupload.com/HowTo.aspx

Please note that with higher executionTimeout value your site will be more vulnerable by DOS attack.

Share

Posted in Windows-IIS-ASPNETComments (0)

Tags:

Essential settings for uploading large file


Assuming we need to upload 20MB files via script on website, you need to make the following necessary changes.

ASP
settings:
1) write permission to IUSR
2)
AspMaxRequestEntityAllowed = 204800000  – global settings in metabase.xml
Connectiontimeout = 1000 ~ 3000 seconds  – iis entry
AspBufferingLimit – global settings in metabase.xml
in iis
4) Script timeout = 270 seconds – iis entry / server.scripttimeout = 12000 – in code

PHP
settings:
1) write permission to IUSR & Network
2)
upload_max_filesize = 20M
max_input_time = 3000
max_execution_time = 3000
memory_limit = 30Min
file_uploads = On
post_max_size
in php.ini
3) Connectiontimeout = 3000 seconds in iis
4) maxAllowedContentLength = 26214400 for iis7      

ASP.NET
settings:
1) write permission to Network Service
2)
executionTimeout="1200"
maxRequestLength="20480" 
enable="true"
in httpRuntime tag in web.config
http://msdn.microsoft.com/en-us/library/e1f13641(VS.80).aspx

problem when uploading large file
considering memory: http://www.motobit.com/help/scptutl/pa31.htm
pool will be recycled during uploading

Share

Posted in Windows-IIS-ASPNETComments (0)