Creating an Azure Website for large file uploads (via POST)

Recently I had a need for a really simple website where people can upload 20 – 30 MB videos from their phone.

Large files?  Simple Website?  Seems like a quick project for an Azure website with an Azure Blob Storage account.

Setting up the site was simple, the code was simple, but large files via HTTP, IIS and the like proved to have a few challenges.  I am sharing this, in hopes that others don’t struggle with the same challenges I did.  You can find the code here:

Want to get it up and running?  Simply follow these 5 steps:

Step 1: Using git, clone the site to your local machine by running the following command:

git clone

Step 2: Open mediaUpload\mediaupload.sln in Visual Studio

Step 3: Modify lines 17, 18 and 19 in Startup.cs to reflect your Blob Storage Container, Azure Storage Account Connection String and initial Login Password, shown below:


Step 4: In the Solution Explorer Window, right click the project mediaupload and select Publish, as shown below:


Step 5: Select the target you desire.  I normally use a shared Application Service Plan, to be the best use of my Azure dollars.


The website is simple with no branding.  There are 3 pages: login (with a password):


Upload file (configurable data points that are added to the file as properties):


List (showing all the files and data, plus providing a download link with a SAS token for 1 hour):


Initial challenges with the website:

  1. Receiving Files from a form
  2. IIS limiting the file upload size
  3. .Net limiting the size of a POST
  4. Kestrel requires OutOfProcess for the hosting model

Receiving files from a form:

This should have been simple, but I was defaulting my verbs in the form to GET, and you can’t post a large file with GET.  Notice in Startup.cs, that only “/receive” is a POST, all the others are a GET:

            app.UseEndpoints(endpoints =>
                endpoints.MapGet("/", defaultGet);
                endpoints.MapGet("/list", defaultList);
                endpoints.MapGet("/submit", defaultSubmit);
                endpoints.MapPost("/receive", defaultPost);

Sadly, it took me thinking about this to resolve this issue.

IIS limiting the file upload size:

By default, IIS limits file uploads to ~30 MB.  To change this, we have to add a “requestLimits maxAllowedContentLength=”1048576000” to the web.config.  You will see this as the only entry in the web.conf, which when Visual Studio publishes, gets merged with the target web.config.

.Net limiting the size of a POST:

Natively .Net Core will also limit the size of a post.  To address this, I had to use the Kestrel server.  You will notice this in lines 16-21 in Program.cs, as shown below.  Also note that I just removed the MaxRequestBodySize limit.

                    webBuilder.UseStartup().UseKestrel(options => {
                        // dangerous?  removing the max body limit when posting
                        options.Limits.MaxRequestBodySize = null;

Kestrel requires OutOfProcess for the hosting model:

Now that I am using Kestrel, by default the website will not start.  This is because Kestrel requires OutOfProcess for the hosting model.  To address this, you will see lines 6 in mediaupload.csproj as shown below:


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s