Hello everyone,
I’d like to share a recent issue we encountered and how it was resolved, in case it helps others facing similar problems.
While deploying our ASP.NET Web Forms application to the Microsoft Azure live server, we encountered the following error when attempting to upload large image files (approximately 2.5 MB):
Request Entity Too Large
Microsoft-Azure-Application-Gateway/v2
Investigation:
Initially, the application worked perfectly in our local environment and on-premises server after setting the following in web.config
:
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="1552428800" />
</requestFiltering>
</security>
</system.webServer>
However, in Azure, the issue persisted. We realized the problem was due to the default request size limit on Azure Application Gateway, which is 128 KB for request bodies.
🛠 Resolution:
After multiple discussions and escalations, we confirmed that the Azure Application Gateway HTTP setting had to be updated.
Steps:
Go to your Azure Application Gateway resource.
Under Settings, open HTTP Settings.
Select the relevant HTTP setting.
Enable "Override with new settings" if not already.
Set "Request body size (KB)" to a higher value (we used 3000 KB).
Save the changes and wait for the update to propagate.
Once this was done, image uploads started working immediately without any additional changes on the code side.
Thank You.