问题
Here is the architecture of the application:
- Web API written in ASP.NET Core.
- Dockerfile builds the Web application using
microsoft/dotnet:2.1-sdk
and executes the API usingmicrosoft/dotnet:aspnetcore-rumtime
. The app is compiled and placed into/app
. - The command executed to start the API is:
ENTRYPOINT ["dotnet", "/app/WebAPI.dll"]
- This API is deployed to an Azure Container Registry (Docker registry).
- An Azure App Service is used to host the API. The App Service is configured to pull the given container from the ACR.
- The API runs exactly as expected.
The problem is that we need to accept post body sizes larger than the 28.6MB limit imposed by IIS and Kestrel. We have tried the approaches at this URL with no success: https://www.talkingdotnet.com/how-to-increase-file-upload-size-asp-net-core/
- Adding a Web.config file to the project does not help since it is not picked up by the ASP.NET Core runtime running in the container. (within the container only Kestrel is running)
- Adding the
[RequestSizeLimit]
attribute does not solve the problem because I believe the actual limitation is occurring at the Azure level.- If I understand correctly, Dockerized ASP.NET Core apps running on Kestrel inside containers are reverse-proxied from an Azure IIS server. Thus the 28.6MB limitation likely exists at the IIS server.
- Setting the size limit in
UesKestrel
also has no effect. - When we tried to implement the "middleware" solution we find that
Features
is not a property of thecontext
object as given in the code on the page.
We need to know how to increase the maximum post size. It is OK if this is at the entire App Service Plan level. Since we are running containers though, we don't know where we could place a Web.config file with the appropriate setting.
回答1:
If you use Kubernetes on Azure, instead of Azure App Service, you can upload over 100MB without any issues. https://azure.microsoft.com/en-us/services/kubernetes-service/
来源:https://stackoverflow.com/questions/56482376/increasing-the-maximum-upload-size-limit-for-a-dockerized-asp-net-core-site-runn