增加在Azure上运行的Dockerized ASP.NET Core网站的最大上传大小限制? [英] Increasing the maximum upload size limit for a Dockerized ASP.NET Core site running on Azure?
问题描述
这是应用程序的体系结构:
Here is the architecture of the application:
- 用ASP.NET Core编写的Web API.
- Dockerfile使用
microsoft/dotnet:2.1-sdk
构建Web应用程序,并使用microsoft/dotnet:aspnetcore-rumtime
执行API.该应用程序已编译并放入/app
. - 为启动API而执行的命令为:
ENTRYPOINT ["dotnet", "/app/WebAPI.dll"]
- 此API已部署到Azure容器注册表(Docker注册表).
- 使用Azure应用服务托管API. App Service已配置为从ACR中提取给定的容器.
- API完全按预期运行.
- 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.
问题在于,我们需要接受大于IIS和Kestrel所规定的28.6MB限制的帖子正文大小.我们已经在此URL上尝试了这种方法,但没有成功:
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/
- 将Web.config文件添加到项目中无济于事,因为容器中运行的ASP.NET Core运行时未拾取该文件. (仅在Kestrel正在运行的容器内)
- 添加
[RequestSizeLimit]
属性不能解决问题,因为我认为实际限制是在Azure级别上发生的.- 如果我正确理解,则容器中Kestrel上运行的Dockerized ASP.NET Core应用程序是从Azure IIS服务器反向代理的.因此IIS服务器上可能存在28.6MB的限制.
- 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.
我们需要知道如何增加最大帖子大小.如果这是在整个应用程序服务计划级别,则可以.由于我们正在运行容器,因此我们不知道可以在何处放置具有适当设置的Web.config文件.
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.
推荐答案
如果在Azure上使用Kubernetes(而不是Azure App Service),则可以上传100MB以上的内容,而不会出现任何问题. https://azure.microsoft.com/en-us/services/kubernetes -服务/
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/
这篇关于增加在Azure上运行的Dockerized ASP.NET Core网站的最大上传大小限制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!