I've got an Azure Linux App Service for running a Spring boot JAR.
In this application I have several forms for uploading files to the Spring app, which then get processed.
This all works perfectly locally , and on an AWS Elastic Beanstalk instance.
On The Azure Linux App Service, with files over around 4MB it fails.
My guess is that an IIS instance that probably runs in front of the App Service has a limit of sorts that blocks post request over a certain size.
I've been looking for any setting I can make on the azure portal to allow bigger files to get uploaded, but just haven't been able to find any.
Any ideas?
(in case you are using Spring boot and Maven for deployment, etc)
Based of @GeorgeChen answer below.
Create a web.config on the root of my Maven project, like so:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<!-- 100 MB in kilobytes -->
<httpRuntime maxRequestLength="204800" />
</system.web>
<system.webServer>
<security>
<requestFiltering>
<!-- 100 MB in bytes -->
<requestLimits maxAllowedContentLength="209715200" />
</requestFiltering>
</security>
</system.webServer>
</configuration>
Modified the POM file, on the Maven plugin section:
<plugin>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-webapp-maven-plugin</artifactId>
<version>1.6.0</version>
<configuration>
<schemaVersion>V2</schemaVersion>
<resourceGroup>XXXXXXXXX</resourceGroup>
<appName>YYYYYYYYYYY</appName>
<region>northeurope</region>
<pricingTier>B2</pricingTier>
<runtime>
<os>linux</os>
<javaVersion>jre8</javaVersion>
<webContainer>jre8</webContainer>
</runtime>
<deployment>
<resources>
<resource><directory>${project.basedir}/target</directory>
<includes>
<include>*.jar</include>
</includes>
</resource>
<resource>
<directory>${project.basedir}</directory>
<targetPath>/</targetPath>
<includes>
<include>web.config</include>
</includes>
</resource>
</resources>
</deployment>
</configuration>
</plugin>
Now after packaging and deploying everything works, and upload can go up to 100MB through Azure.
The default request size is 4MB, you could get it here: support request File Upload utility guidelines. So you have to increase that limit if you want to allow uploading and downloading of larger files.
You could set maxRequestLength
and maxAllowedContentLength
values in your web.config
file.
Here is a sample web.config.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<!-- 100 MB in kilobytes -->
<httpRuntime maxRequestLength="204800" />
</system.web>
<system.webServer>
<security>
<requestFiltering>
<!-- 100 MB in bytes -->
<requestLimits maxAllowedContentLength="209715200" />
</requestFiltering>
</security>
</system.webServer>
Further more information, you could refer to this blog:Upload Large File In asp.net or website in Windows Azure .
And beside this, you could choose to upload file to Azure Storage to handle large files. This is about using Web API and Azure Blob.