1

I've an MVC Azure Webapp with a file upload and I'm getting timeout error when I try to uplaod file bigger than 1MB (I don't know why this size is the "limit"). With smaller file everything is ok.

In my Web.config I put:

<httpRuntime targetFramework="4.5.2" maxRequestLength="10240" executionTimeout="600"/>

under <system.web> section and

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

under the <system.webServer> section but that didn't solve the problem. (In any case default maxAllowedContentLength is 28MB and default maxAllowedContentLength is 4MB so it should be ok with 1MB files!)

I also tried to set the SCM_COMMAND_IDLE_TIMEOUT Application Variable (as indicated here ) from Azure Portal to the value 360 but the problem persists.

Azure Service Plan for the webapp is Standard1 so it isn't free or shared and the "Always On" switch in the application setting is set to "Yes"

What am I doing wrong?

EDIT: another, maybe important, detail is that the request timeout is always given after 4 minutes

Solved: I figure out it was not a problem about the file size but actually it was the 4 minutes timeout due to a time consuming task performed on the uploaded file and executed within the http context. I split the logic keeping just the file upload in the controller and using an Azure Queue to notify a new Azure WebJob when a new file has been uploaded. The new WebJobs now takes care of the time consuming elaboration over the file rows.

Davis Molinari
  • 741
  • 1
  • 5
  • 20

1 Answers1

0

Based on my understanding, if maxRequestLength and maxAllowedContentLength are larger than uploaded file, the file can be uploaded. I tried on my side, it really works well. I would suggest you using KUDU to see the web.config file on Azure web app. Refer to https://blogs.msdn.microsoft.com/benjaminperkins/2014/03/24/using-kudu-with-windows-azure-web-sites/ for more information about KUDU, click 'Debug Console' to check your web.config file. In my opinion, it is not a good choice to upload file to Azure web app server. The best choice is to upload to Azure storage. For the detailed reasons, refer to How do I store files on Windows Azure Web Site?. Please try uploading files to Azure Storage instead.

Community
  • 1
  • 1
Jambor - MSFT
  • 3,175
  • 1
  • 13
  • 16