MaxAllowedContentLength not working for IHttpHandler IIS7

I have an ASP.NET IHttpHandler module that handles file uploads. I set the file size limit to 50 MB in the configuration file

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

But still get an error while loading the 13mb file.

 System.Web.HttpException (0x80004005): Maximum request length exceeded. 

How to increase the default allowed file size?

+4
source share
2 answers

Use the following in web.config web application

 <httpRuntime maxRequestLength="52428800" /> 
+1
source

To summarize, to increase the file upload size to 50 MiB in IIS7, add the lines below in the correct section of the Web.config file:

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

and

  <system.web> <httpRuntime maxRequestLength="51200" /> </system.web> 

1024 X 1024 X 50 = 5242880 bytes in 50 miles

1024 X 50 = 51200 KiB in 50 MiB

+2
source

Source: https://habr.com/ru/post/1384284/


All Articles