maxRequestLength vs. maxAllowedContentLength on II

2019-04-26 18:25发布

问题:

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?

回答1:

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