I have a Razor Pages app with a file upload page. I want to allow up to 60 MB uploads on that page. I can get do this locally by adding a <requestLimits maxAllowedContentLength="62914560" /> tag to my local applicationhost.config file in the .vs directory, but that doesn't help the deploy.
Here's what I've tried
- Adding
[RequestFormLimits(MultipartBodyLengthLimit = 60 * 1024 * 1024)]and[RequestSizeLimit(60 * 1024 * 1024)]to thePageModelfor the page in question - Adding
services.Configure<FormOptions>(options => { options.MultipartBodyLengthLimit = 60 * 1024 * 1024; });to myStartup.cs - Adding a middleware handler with
app.UseWhen(context => context.Request.Path.StartsWithSegments("/mypagepath"), appBuilder => { appBuilder.Features.Get<IHttpMaxRequestBodySizeFeature>().MaxRequestBodySize = null; }); - Adding a
Web.configfile to the root of the project with the<requestLimits>tag. If I deploy that file the whole app stops working.
Everything works locally but when I deploy to my Azure App Service, I get this error
The page was not displayed because the request entity is too large.