Click here to Skip to main content
15,888,984 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have to upload a file like 1 Gb or more than it have to upload.

but currently, only 241 MB file can upload more than it fails to upload.

In a webconfig I add code for upload large file.

Please give me hint where I am wrong.

What I have tried:

<system.webServer>
    <security>
      <!--<requestFiltering allowDoubleEscaping="true"/>-->
      <requestFiltering allowDoubleEscaping="true">
        <!-- This will handle requests up to 3000MB (3GB) -->
        <requestLimits maxAllowedContentLength="3000000000" />
      </requestFiltering>
    </security>
  </system.webServer>



<httpRuntime targetFramework="4.5.2" executionTimeout="9999" maxRequestLength="2097151" />
Posted
Updated 3-Apr-18 3:50am

maxRequestLength[^] is measured in kilobytes and maxAllowedContentLength[^] is measured in bytes. They have to be equal.

For 1GB it would be:
web.config:
HTML
<configuration>
    <system.web>
        <httpRuntime maxRequestLength="1048576" />
    </system.web>
</configuration>

IIS7 and above settings:
HTML
<system.webServer>
   <security>
      <requestFiltering>
         <requestLimits maxAllowedContentLength="1073741824" />
      </requestFiltering>
   </security>
 </system.webServer>


See:
asp.net - Maximum request length exceeded.[^]
asp.net - How to set the maxAllowedContentLength to 500MB while running on IIS7?[^]
Request Limits <requestLimits> | Microsoft Docs[^]
How much is 1 byte, kilobyte, megabyte, gigabyte, etc.?[^]
 
Share this answer
 
v2
add in webconfig (executionTimeout="9999" maxRequestLength="2097151"also requried)

<system.webServer>
   <security>
     <!--<requestFiltering allowDoubleEscaping="true"/>-->
     <requestFiltering allowDoubleEscaping="true">
       <!-- This will handle requests up to 3000MB (3GB) -->
       <requestLimits maxAllowedContentLength="3000000000" />
     </requestFiltering>
   </security>
 </system.webServer>



and

<httpRuntime targetFramework="4.5.2" executionTimeout="9999" maxRequestLength="2097151" />
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900