0

I added a File Upload Control to my website but when I add a large file, I got this error:

The request filtering module is configured to deny a request that exceeds the request content length.

I searched and found a suggested solution was to add this code in the web config

<httpRuntime targetFramework="4.5" maxRequestLength="512000000"/>    

and to edit the IIS application host Config and add this code to it

<maxAllowedContentLength="512000000"/>

I made all of these steps and it did not work. I still cannot upload a file larger than the max size.

TimCodes.NET
  • 4,601
  • 1
  • 25
  • 36
user3742682
  • 93
  • 2
  • 5

3 Answers3

1

If you are using IIS6 you need to set the following in your Web.Config (kilobytes and default is 4096 which is 4 MB):

<system.web>
  <httpRuntime targetFramework="4.5" maxRequestLength="4096000" />
</system.web>

If you are using IIS7 or later (in bytes and default is 30000000 which is almost 30MB):

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

Make sure you don't add these tags if they already exist. Edit the existing ones otherwise.

Dacker
  • 892
  • 2
  • 8
  • 12
0

Are running on dev machine? IIS Express or Cassini? Any way thet thing is to set up your web.config.

Try this solution:

<httpRuntime 
executionTimeout="90" 
maxRequestLength="1024000" 
useFullyQualifiedRedirectUrl="false" 
minFreeThreads="8" 
minLocalRequestFreeThreads="4" 
appRequestQueueLimit="100" 
enableVersionHeader="true"
/>

http://www.codeproject.com/Articles/10842/Setting-up-Web-config-to-allow-uploading-of-large

Alan Araya
  • 701
  • 1
  • 12
  • 27
0

be sure that you add this key under <system.web> and also add a attribute "execution time" as below code:

<httpRuntime executionTimeout="10000"maxRequestLength="10240000"maxQueryStringLength="2097151"/>
ashkan
  • 59
  • 5