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:
I've also added the following in my program.cs:
and even this in my appsettings.json:
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
5 Replies
to add: this is my handler method
There's a bunch of places this needs to be set. I'd check the docs, overall larger file uploads are a vulnerability, that's why the settings are there.
Instead on the upload request you can mint a sas token, send that back to the client, client uses the limited scope token to upload large files with the sdk
Thanks for the reply. I ended up finally getting it to work by adding a web.config with the following:
this works.
I'm not really sure about sas tokens. I got turned off once it started talking about entra id and all that. Do you know of any good tutorials?
If you have no further questions, please use /close to mark the forum thread as answered
I don't, it's well documented, I'm sure you can find an example without looking too hard. Just make sure sas tokens are as tightly scooped as possible and short lived.