Uploading Large Files to Azure Web Apps

Link: Microsoft Azure Open Source Development Support Team Blog

Attempting to upload a file larger than 28.6MB to Azure Web Apps can result in a HTTP 404.13 error. This can be due to the default Request Limits value for the maxAllowedContentLength on IIS which is 30000000 (roughly 28.6MB). To modify this value, add the following to your web.config file:

<requestLimits maxAllowedContentLength=”60000000″ />

Setting maxAllowedContentLength is in bytes, so in this case the limit is set to 60MB. When setting this value too high, you can get a Http Error 503: Service Unavailable. This means that your webservice tries to execute too large an amount of work at once. I had this error when I tried to set the value to 80MB.

What’s the catch? I thought you only had to change maxReceivedMessageSize in the BasicHttpBinding config like below. But that setting alone doesn’t do the trick.

<binding name=”basicHttpBindingConfig” maxBufferSize=”80000000″ maxBufferPoolSize=”80000000″ maxReceivedMessageSize=”80000000″ messageEncoding=”Mtom”>
<readerQuotas maxDepth=”80000000″ maxStringContentLength=”80000000″ maxArrayLength=”80000000″ maxBytesPerRead=”80000000″ maxNameTableCharCount=”80000000″ />
<security mode=”Transport”>
<transport clientCredentialType=”None”/>

One addition. I think it’s wrong to set maxBufferSize and MaxBufferPoolSize to the same value as MaxReceivedMessageSize. I also think you don’t need the <readerQuotas> node. I will have to dive into that.


Leave a Reply

Your email address will not be published. Required fields are marked *