© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•6mo ago•
5 replies
JayNic

Request Entity Too Large in Azure Web App Production Environment

I'm encountering an error when I'm using an OnPost handler in a razor page to upload files.
In debug: the files upload no problem, but as soon as I push to production and try on the actual site: it gives me this error.

I have put the following on my PageModel:
[RequestSizeLimit(100 * 1024 * 1024)]
[RequestFormLimits(MultipartBodyLengthLimit = 100 * 1024 * 1024)]
public class ImagesManagerModel : PageModelBase
{
...
[RequestSizeLimit(100 * 1024 * 1024)]
[RequestFormLimits(MultipartBodyLengthLimit = 100 * 1024 * 1024)]
public class ImagesManagerModel : PageModelBase
{
...


I've also added the following in my program.cs:
builder.WebHost.ConfigureKestrel(opt =>
{
    opt.Limits.MaxRequestBodySize = 100 * 1024 * 1024;
});
builder.Services.Configure<FormOptions>(options =>
{
    options.MultipartBodyLengthLimit = 100 * 1024 * 1024;
});
builder.WebHost.ConfigureKestrel(opt =>
{
    opt.Limits.MaxRequestBodySize = 100 * 1024 * 1024;
});
builder.Services.Configure<FormOptions>(options =>
{
    options.MultipartBodyLengthLimit = 100 * 1024 * 1024;
});


and even this in my appsettings.json:
{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft.AspNetCore": "Warning"
    }
  },
  "AllowedHosts": "*",
  "FormOptions": {
    "MultipartBodyLengthLimit": 100000000
  }
}
{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft.AspNetCore": "Warning"
    }
  },
  "AllowedHosts": "*",
  "FormOptions": {
    "MultipartBodyLengthLimit": 100000000
  }
}


The app is hosted as an Azure App Service. Is there a portal side thing I need to change? Or am I going about this in the totally wrong way?

Thanks
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

413 request entity too large postman
C#CC# / help
4y ago
❔ HTTP Error 413.1 - Request Entity Too Large
C#CC# / help
4y ago
✅ How to setup environment variables in Azure Web App
C#CC# / help
11mo ago
Azure Static Web App (Blazor) problem with CORS
C#CC# / help
14mo ago