asp.net - Web.config maxRequestLength 被忽略,只有 maxAllowedContentLength 有效

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

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

我已将 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"/>

最佳答案

Does anyone know why maxRequestLength is ignored for ASP and/or COM?

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

来自httpRuntime Element (ASP.NET Settings Schema)

Configures ASP.NET HTTP run-time settings that determine how to process a request for an ASP.NET application.

关于asp.net - Web.config maxRequestLength 被忽略,只有 maxAllowedContentLength 有效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36818003/

相关文章:

c# - ASP.NET 图表无法在服务器上运行

c# - 可以在 IIS 中对静态 html 页面进行后处理吗?

asp-classic - 如何在经典 ASP 中获取当前域?

javascript - 为什么这个 Javascript POST 不起作用?

asp.net - Elmah:在 IIS7 下未调用 ErrorLog_Filtering 事件处理程序

.net - 如何在 asp.net formsAuthentication 中使用户超时

c# - 检测移动浏览器并重定向到移动网站的更好地方

asp.net - 如何在 ASP.NET 中将文本框的宽度设置为与 MaxLength 相同

HTML masonry 布局问题 (asp.net)

vbscript - 尝试 "Include".VBS 文件中的 .ASP 文件