【问题标题】:Azure App Service IIS "maxRequestLength" settingAzure 应用服务 IIS“maxRequestLength”设置
【发布时间】:2017-08-28 10:47:00
【问题描述】:

我在 Azure 应用服务上部署了一个 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."

要设置“ma​​xAllowedContentLength”,我必须编辑“web.config”文件。

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

是否可以以不同的方式设置“ma​​xAllowedContentLength”?

【问题讨论】:

  • 在 Azure 门户中添加 maxAllowedContentLength 作为应用设置有什么问题?
  • 完全正确,但据我所知,Azure 门户的应用程序设置中尚未作为选项出现
  • 编辑自动生成的web.config 是否可以设置阈值。感谢弗雷德

标签: node.js azure iis


【解决方案1】:

“Web服务器上配置了请求过滤,拒绝请求,因为内容长度超过了配置的值。”

据我所知,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 网站。如果您遇到任何冲突错误,请与我们分享错误详情。

【讨论】:

  • 如果我创建一个 web.config 文件,其中只包含将应用程序停止工作的设置!可能我在编写文件时出错了。你能给我一个有效的例子吗?谢谢!
  • 我的 web.config 是 &lt;configuration&gt; &lt;system.webServer&gt; &lt;security&gt; &lt;requestFiltering&gt; &lt;requestLimits maxAllowedContentLength="52428800"/&gt; &lt;/requestFiltering&gt; &lt;/security&gt; &lt;/system.webServer&gt; &lt;/configuration&gt; ,这个文件的任何请求都会进入 404 !
  • 请尝试查看和编辑自动生成的 web.config 来配置 requestLimits uisng kudu or App Service Editor 的 requestLimits 属性。
  • @Toto 你解决这个问题了吗?
  • 是的@Fred Han我按照你说的从自动生成的文件开始。谢谢!
猜你喜欢
  • 2018-04-12
  • 2020-08-13
  • 2021-10-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-09-06
  • 2018-07-10
相关资源
最近更新 更多