74

If we are using IIS 7 and .Net Framework 4, what will be the maximum value of maxRequestLength?

Pure.Krome
  • 84,693
  • 113
  • 396
  • 647
Erkan BALABAN
  • 1,347
  • 1
  • 13
  • 20

5 Answers5

92

Maximum is 2097151, If you try set more error occurred.

Petr
  • 2,603
  • 2
  • 17
  • 9
  • 6
    I'm confused. The accepted answer is 2147483647, but this answer which is up-voted a lot more says 2097151. Which is it? – Homer Jan 08 '16 at 21:27
  • 7
    @Homer one is bytes and the other is kilobytes. The value is specified in kB so you should use 2097151 – Ramón May 02 '16 at 23:06
  • @Homer the accepted answer only states the maximum value of the int type, where as IIS accepts this as the maximum value. – ywm Jul 06 '16 at 10:39
77

These two settings worked for me to upload 1GB mp4 videos.

<system.web>
    <httpRuntime maxRequestLength="2097152" requestLengthDiskThreshold="2097152" executionTimeout="240"/>
</system.web>
<system.webServer>
    <security>
        <requestFiltering>
            <requestLimits maxAllowedContentLength="2147483648" />
        </requestFiltering>
    </security>
</system.webServer>
JJ_Coder4Hire
  • 4,706
  • 1
  • 37
  • 25
51

As per MSDN the default value is 4096 KB (4 MB).

UPDATE

As for the Maximum, since it is an int data type, then theoretically you can go up to 2,147,483,647. Also I wanted to make sure that you are aware that IIS 7 uses maxAllowedContentLength for specifying file upload size. By default it is set to 30000000 around 30MB and being an uint, it should theoretically allow a max of 4,294,967,295

Waleed Al-Balooshi
  • 6,318
  • 23
  • 21
7

2,147,483,647 bytes, since the value is a signed integer (Int32). That's probably more than you'll need.

Mark
  • 11,257
  • 11
  • 61
  • 97
  • Equivalent of your value would be 2,097,152 (kB), which is *out of range* by 1. The maximum value is 2,097,151 (kB) i.e. 2,147,482,624 bytes. – Peter Ivan Jan 10 '13 at 12:47
  • 3
    Int32.MaxValue is 2,147,483,647. I didn't make this number up. If you doubt me, open up PowerShell and type `[int]::maxvalue` and see what you get. – Mark Jan 10 '13 at 16:36
  • 2
    Have you tried to set `maxRequestLength` to 2,147,483,647 or 2,097,152? You'll get a Configuration Error. That's why your answer is incorrect and I comment on it. `[int]::maxvalue` is not in an allowed range. – Peter Ivan Jan 11 '13 at 07:12
  • I've test maxRequestLength = 2147483648 and did not receive an error for IIS 7.5. Mark is correct. Perhaps it is different for IIS 6? – Timothy Schoonover Sep 25 '15 at 14:25
2

Right value is below. (Tried)

maxRequestLength="2147483647" targetFramework="4.5.2"/>
Suraj Rao
  • 29,388
  • 11
  • 94
  • 103