Azure应用服务IIS“maxRequestLength”设置

时间:2017-04-03 14:06:57

标签: node.js azure iis

我在Azure App Service上部署了NodeJS应用程序。 使用38 MB的文件发帖我得到了404错误但是在引擎盖下有一个IIS问题"Request filtering is configured on the Web server to deny the request because the content length exceeds the configured value."

要设置' maxAllowedContentLength ',我必须修改' web.config '文件。

这不太好,因为如果我对Azure门户应用设置进行了一些更改,我的本地版 web.config '会与自动生成的文件冲突。

是否可以以不同的方式设置' maxAllowedContentLength '?

1 个答案:

答案 0 :(得分:2)

  

"在Web服务器上配置请求筛选以拒绝请求,因为内容长度超过了配置的值。"

据我所知,maxAllowedContentLength的默认值是30000000(约28.6MB)。我们可以connecting to a Windows Azure Website from IIS Manager with remote administration,然后我们可以找到请求限制,就像这样。

enter image description here

因此,当您发布约38MB数据时,请求将失败。在我这边,我在web.config中增加了maxAllowedContentLength的值,我可以从我的Web API发布大于28.6MB的数据。

<security>
  <requestFiltering>
    <requestLimits maxAllowedContentLength="<valueInBytes>"/>
  </requestFiltering>
</security>

请求我的Web API:

enter image description here

您可以在本地web.config中配置/修改maxAllowedContentLength属性,并使用web.config将您的应用程序部署到Azure网站。如果您遇到任何冲突错误,请与我们分享错误详情。