我在 Azure 应用服务上部署了一个 NodeJS 应用程序。
使用 38 MB 的文件进行发布时,我收到 404 错误,但实际上存在 IIS 问题 “在 Web 服务器上配置请求过滤以拒绝请求,因为内容长度超过配置值。”
要设置“maxAllowedContentLength”,我必须编辑“web.config”文件。
这不好,因为如果我对 Azure 门户应用程序设置进行一些更改,我的本地版本的 web.config' 就会与自动生成的文件发生冲突。
是否可以以不同的方式设置“maxAllowedContentLength”?
最佳答案
"Request filtering is configured on the Web server to deny the request because the content length exceeds the configured value."
据我所知,maxAllowedContentLength的默认值为30000000(大约28.6MB)。我们可以 connecting to a Windows Azure Website from IIS Manager with remote administration ,然后我们就可以找到请求限制,如下所示。
因此,当您发布大约 38MB 数据时,请求将失败。在我这边,我增加了 web.config 中 maxAllowedContentLength 的值,我可以从我的 Web API 发布大于 28.6MB 的数据。
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="<valueInBytes>"/>
</requestFiltering>
</security>
对我的 Web API 的请求:
您可以在本地 web.config 中配置/修改 maxAllowedContentLength 属性,并使用 web.config 将应用程序部署到您的 Azure 网站。如果您遇到任何冲突错误,请与我们分享错误详细信息。
关于node.js - Azure 应用服务 IIS "maxRequestLength"设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43186826/