Request length difference Azure app service deployed on Windows and Linux

Abdul Qadir 0 Reputation points


I have one application implemented using web api 6 which is deployed on windows flavor. which is causing issue while trying to upload even 100 mb file

"the page was not displayed because the request entity is too large."

How can increase the request length which supports upto 300 mb request size.

it is an web api 6 project and does not have any web.config file

The same application deployed on linux flavor works fine even for 300 mb request length.

Please suggest how to do it

A set of technologies in the .NET Framework for building web applications and XML web services.
4,133 questions
ASP.NET: A set of technologies in the .NET Framework for building web applications and XML web services.API: A software intermediary that allows two applications to interact with each other.
292 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,810 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Bruce ( 54,626 Reputation points

    while core does not use web.config, IIS does and the maxAllowedContentLength controls this. The publish creates the web.config if the project does not have one.

    0 comments No comments

  2. ajkuma 22,081 Reputation points Microsoft Employee

    Based on your issue description, I understand the same config works fine on Linux, but not on Windows. Just confirming, if the same issue happens locally?

    I have also added additional tags' to receive insights from the targetted SMEs.

    If you haven't done this already, to increase the request length in your Web API 6 project, you can add the following code in the Startup.cs file:

    using Microsoft.AspNetCore.Builder;
    using Microsoft.AspNetCore.Hosting;
    using Microsoft.AspNetCore.Http;
    using Microsoft.Extensions.DependencyInjection;
    namespace WebApi6
        public class Startup
            public void ConfigureServices(IServiceCollection services)
                services.Configure<FormOptions>(x =>
                    x.ValueLengthLimit = int.MaxValue;
                    x.MultipartBodyLengthLimit = int.MaxValue;
                    x.MultipartHeadersLengthLimit = int.MaxValue;
            public void Configure(IApplicationBuilder app, IHostingEnvironment env)

    The above code sets the maximum length for the request body, the multipart body, and the multipart headers to the maximum value that can be represented by an integer.

    If you haven't done this already so, you may also set the maximum length to a specific value, such as 300 MB, by replacing int.MaxValue with the desired value in bytes.

    0 comments No comments