Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the maxAllowedContentLength of IIS 7.0?

Tags:

asp.net

iis-7

Ii have a problem similar to: How to set the maxAllowedContentLength to 500MB while running on IIS7?

The difference is that I have already modified my web.config to accept files upto 2 Gb in size but when try and upload a large file, I get the following error:

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

my web.config is this:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.web>
        <httpRuntime executionTimeout="999999" maxRequestLength="2097151"/>
        <customErrors mode="Off"/>      
        <compilation debug="true" strict="false" explicit="true" targetFramework="4.0" />
            <membership>
            <providers>
            <clear/>
            </providers>
        </membership>
        <profile>
            <providers>
            <clear/>

            </providers>
        </profile>
        <roleManager enabled="false">
            <providers>
            <clear/>

            </providers>
        </roleManager>
</system.web>
<system.webServer>
    <security>
        <requestFiltering>
            <requestLimits maxAllowedContentLength="2097151" />
        </requestFiltering>
    </security>
</system.webServer>

I still receive the error when i try to upload a file that it is only 131 MB.

So, what should I set in the maxAllowedContentLength settings to allow people to upload files over 100 MB please?

like image 907
JUAN Avatar asked Oct 30 '12 18:10

JUAN


2 Answers

While MaxRequestLength is number of kilobytes, maxAllowedContentLength is number of bytes. Multiply it again by 1024, and it should work fine.

maxAllowedContentLength
Optional uint attribute.
Specifies the maximum length of content in a request, in bytes.
The default value is 30000000.
http://msdn.microsoft.com/en-us/library/ms689462(v=vs.90).aspx

like image 55
sshow Avatar answered Oct 03 '22 17:10

sshow


Type inetmgr in windows Run (WinKey + r) click your server name on left panel and in right panel in IIS section double click Request Filtering. on the rightest panel click Edit Feature Settings... . In Request Limits section you can change the maxAllowedContentLength.

If you want change maxAllowedContentLength just in one of your sites, on the left panel select your site under Sites and go the same way as above to change it.

like image 33
ele2a Avatar answered Oct 03 '22 15:10

ele2a