maxAllowedContentLength is supposed to work on IIS 7+ servers but apparently my server doesn't want to take this value into account when uploading (ASP.NET MVC 3 website). Now that I included maxRequestLength in web.config everything started to work and the value was applied. Yet everywhere everyone is saying that the maxAllowedContentLength is the right one.
Does anyone has an explanation for this behaviour?
Use the maxRequestLength of the httpRuntime element. The default size is 4096 kilobytes (4 MB). Max value 2,147,483,647 kilobytes (~82 Terabyte).
The MaxRequestLength property specifies the limit for the buffering threshold of the input stream. For example, this limit can be used to prevent denial of service attacks that are caused by users who post large files to the server.
The maxAllowedContentLength Request Filter is the maximum size of the http request, measured in bytes, which can be sent from a client to the server. Configuring this value enables the total request size to be restricted to a configured value.
Take a look at the link below - it explains the difference between the two. You'll need to set both if you are going to be uploading large files. Note that you can also nest this setting in a <location>
tag so as not to apply the setting to the entire website (which I recommend).
Confusing required maxRequestLength and maxAllowedContentLength settings
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With