Maximum request length exceeded despite setting both maxRequestLength and maxAllowedContentLength

I have a cloud cloud service (web role) and I am sending 5MB of video to a WebApi controller class which distracts the request (which is a MIME request for a multiple body, with form data, and also with a 2 smaller JPG file that 32KB). I am using a custom implementation of MultipartFormDataStreamProvider that saves files to disk.

Works great with files under 4 MB. But even after adding the following to the web.config file, I still get an exception with the maximum length exceeded (under "Error reading MIME multipart body part."). I am working in debug mode and it fails in both the local Azure emulator and the first time I start the cloud service without the Azure emulator. It drives me crazy and takes time to understand why this is happening.

    <security>
  <requestFiltering>
    <requestLimits maxAllowedContentLength="1073741824" />
  </requestFiltering>
</security>

  <system.web>
    <httpRuntime maxRequestLength ="1048576" executionTimeout="3600"/>
  </system.web>

      

+3


source to share





All Articles