user385411
user385411

Reputation: 1465

MVC3:Maximum request length exceeded

Here is the context:

ASP MVC3 - IIS 7

I am using ElMah configured very well as documented nearly everywhere for MVC. And it is working.

Here is what I have in my config file

  <system.web>
    <httpRuntime maxRequestLength="1024" enableVersionHeader="false" />
    <customErrors mode="On" defaultRedirect="~/Error/Generic" />
    ...
     <system.webServer>
        <httpErrors errorMode="Detailed" existingResponse="PassThrough" defaultPath="~/Error/Generic" defaultResponseMode="ExecuteURL"></httpErrors>

Now here is my problem I spent the whole day trying to catch this error : "Maximum request length exceeded" when I submit a file that exceed 1024 bytes

Between asp errors and IIS errors and sometimes IE interception, I'am getting crazy I cannot understand why this is so complicated. I already tried these solutions and none worked for me solution 1 Solution 2

Thank you for your help

Upvotes: 5

Views: 6311

Answers (1)

Robin van der Knaap
Robin van der Knaap

Reputation: 4120

When setting maxRequestLength to 1024 this means 1024 kilobytes, not 1024 bytes. Maybe this is why the exception isn't thrown.

Upvotes: 7

Related Questions