我已经搜索了一段时间,但似乎找不到任何适合我所面临的具体情况的内容。
我已将 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/