How to set maxAllowedContentLength to 500 MB while running on IIS7?

I changed maxAllowedContentLength to

<security> <requestFiltering> <requestLimits maxAllowedContentLength="5024000000" /> </requestFiltering> </security> 

In my web.config, but when working on IIS7 I get this error:

Invalid attribute 'maxAllowedContentLength'. Invalid unsigned integer

http://i.stack.imgur.com/u1ZFe.jpg

but when I start the VS server, it starts normally without any errors.

How to configure my site to allow downloading files with a size of 500 MB without this problem on IIS7?

+53
iis-7 file-upload
Oct 26 '10 at 9:43
source share
3 answers

According to MSDN, maxAllowedContentLength is uint , its maximum value is 4,294,967,295 bytes = 3.99 GB

Therefore, it should work fine.

See also Article with restricted access rights . IIS returns one of these errors when the corresponding section is not configured at all?

See also: Maximum request length exceeded

+64
Oct 26 '10 at 9:52
source share

The request limit in .Net can be configured from two properties together:

First

  • Web.Config/system.web/httpRuntime/maxRequestLength
  • Unit Type: kilobytes
  • The default value is 4096 KB (4 MB)
  • Max. value 2147483647 KB (2 TB)

Second

  • Web.Config/system.webServer/security/requestFiltering/requestLimits/maxAllowedContentLength (in bytes)
  • Unit: Bytes
  • The default value is 30,000,000 bytes (28.6 MB)
  • Max. value 4294967295 bytes (4 GB)

References: http://www.whatsabyte.com/P1/byteconverter.htm https://www.iis.net/configreference/system.webserver/security/requestfiltering/requestlimits

Example:

 <location path="upl"> <system.web> <!--The default size is 4096 kilobytes (4 MB). MaxValue is 2147483647 KB (2 TB)--> <!-- 100 MB in kilobytes --> <httpRuntime maxRequestLength="102400" /> </system.web> <system.webServer> <security> <requestFiltering> <!--The default size is 30000000 bytes (28.6 MB). MaxValue is 4294967295 bytes (4 GB)--> <!-- 100 MB in bytes --> <requestLimits maxAllowedContentLength="104857600" /> </requestFiltering> </security> </system.webServer> </location> 
+49
Oct 17 '16 at 11:41
source share

another factor you can change:

 <location path="NAME PATH CONTROLLER"> 

because this path allows access for all controllers that used the download.

-2
Jul 24 '17 at 22:27
source share



All Articles