2

I have a NodeJS application deployed on a Azure App Service. Doing a post with a file of 38 MB I obtain a 404 error but under the hood there is a IIS problem "Request filtering is configured on the Web server to deny the request because the content length exceeds the configured value."

To set 'maxAllowedContentLength' I have to edit 'web.config' file.

This is not good because if I do some change on the Azure Portal App Settings my local version of web.config' goes in conflict with the auto-generated file.

Is it possible to set on 'maxAllowedContentLength' in a different way ?

Toto
  • 119
  • 2
  • 10
  • 2
    What's the problem with adding maxAllowedContentLength as an App Setting in Azure Portal? – Aram Apr 03 '17 at 17:18
  • Exactly but as I know is not yet present as option in App Settings of Azure Portal – Toto Apr 04 '17 at 10:44
  • Editing auto-generated **web.config** is it possible to set the Threshold. Thanks to Fred – Toto Apr 11 '17 at 09:45

1 Answers1

2

"Request filtering is configured on the Web server to deny the request because the content length exceeds the configured value."

As far as I know, the default value of maxAllowedContentLength is 30000000 (approximately 28.6MB). We could connecting to a Windows Azure Website from IIS Manager with remote administration, and then we could find the request limits, like this.

enter image description here

So the request will fail when you post about 38MB data. On my side, I increase the value of maxAllowedContentLength in web.config, I could post the data that is larger than 28.6MB from my Web API.

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

Request to my Web API:

enter image description here

You could configure/modify maxAllowedContentLength property in your local web.config and deploy your app with web.config to your Azure Website. If you get any conflict error, please share us the error details.

Community
  • 1
  • 1
Fei Han
  • 21,907
  • 1
  • 16
  • 28
  • If I create a web.config file containing only that setting the application stop to working ! Probably I make some error writing the file. Can you give me a valid example ? thanks ! – Toto Apr 04 '17 at 09:05
  • My web.config is ` ` with this file any request goes in 404 ! – Toto Apr 04 '17 at 09:28
  • 1
    Please try to view and edit the auto-generated web.config to configure requestLimits property of requestLimits uisng [kudu or App Service Editor](https://social.technet.microsoft.com/wiki/contents/articles/36467.understanding-the-azure-app-service-editor.aspx). – Fei Han Apr 05 '17 at 08:08
  • @Toto do you fix the issue? – Fei Han Apr 18 '17 at 08:49
  • yes @Fred Han I did as you say starting from autogenerated file. thanks ! – Toto Apr 18 '17 at 13:49
  • If it is helpful, please mark it as accepted answer to help other community members quickly find it and fix the similar issues. – Fei Han Apr 19 '17 at 06:57
  • Thank you!! this helped me so much. I deployed a web app using Node and Express onto Azure and I used multiple middleware such as multer, busboy, I was driving myself crazy debugging. Anyways there were no messages when I uploaded larger files it just failed and restarted in Azure. So I started testing file sizes and wow! I added this line to my config set the bytes to what I needed republish and I was laughing. Cheers. – dfresh22 Nov 30 '18 at 22:42