0

HTTP 错误 413.1 - 请求实体太大 页面未显示,因为请求实体太大

HTTP 错误 413.1 屏幕截图

这是一个 webforms 应用程序,我在 web.config 中设置了这些:

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

<httpRuntime executionTimeout="5400" maxRequestLength="200288" />

这两个设置设置了最大文件大小上传限制。但是,当我使用更大的文件进行测试时,我得到了 IIS 错误页面,并且无法优雅地捕获和处理此错误。

我尝试将 customErrors 设置为 On 或 Custom,但是当错误发生时,它既没有命中默认的 redir 也没有命中自定义的 redir?

<customErrors mode="On" defaultRedirect="/custom_error.aspx">
  <error statusCode="500" redirect="/custom_error.aspx" />
  <error statusCode="404" redirect="/not_found.aspx" />
  <error statusCode="413" redirect="/UploadError.aspx" />
</customErrors>

有任何想法吗?

4

0 回答 0