【问题标题】:Web.config maxRequestLength ignored, only maxAllowedContentLength worksWeb.config maxRequestLength 被忽略,只有 maxAllowedContentLength 有效
【发布时间】:2016-04-24 00:35:08
【问题描述】:

我已经搜索了一段时间,但似乎找不到与我所面临的具体情况有关的任何内容。

我已经将 maxRequestLength 设置为 5MB,就像这样...

<httpRuntime maxRequestLength="5120"/>

然后我将 maxAllowedContentLength 设置为 20MB...

<requestLimits maxAllowedContentLength="20971520"/>

由于某种原因,虽然下限被忽略了。我的应用程序允许上传最大 20MB 的文件。

它认为任何超过 maxRequestLength 的东西都应该触发 .Net 异常。

该应用程序是经典的 ASP,具有管理上传的自定义 Interop COM 对象。

如果我直接使用 .Net 上传,则会遵守限制并引发异常。

有人知道为什么 ASP 和/或 COM 忽略 maxRequestLength 吗?

这发生在 IIS 8 和 IIS 10 中。

我有以下套装,如果有什么不同的话……

<modules runAllManagedModulesForAllRequests="true"/>

【问题讨论】:

    标签: asp.net asp-classic web-config com-interop iis-8


    【解决方案1】:

    有人知道为什么 ASP 和/或 COM 忽略 maxRequestLength 吗?

    与所有其他 system.web 设置一样,它也是一个 ASP.NET 设置。你已经体验过了。所以对于非 ASP.NET 请求被忽略是正常的。

    来自httpRuntime Element (ASP.NET Settings Schema)

    配置 ASP.NET HTTP 运行时设置,确定如何 处理对 ASP.NET 应用程序的请求。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-02-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-12-29
      • 2010-09-22
      相关资源
      最近更新 更多