【发布时间】:2012-06-11 15:06:26
【问题描述】:
我有一个我支持的网络应用程序,它有时需要渲染巨大的网页。
有时我会遇到此异常(它未链接到用户制作的上传,网页呈现大约 22MB 的 Html):
Error Caught in Page : http://example.com/thepage.aspx
Error Message:Maximum request length exceeded.
Stack Trace: at System.Web.HttpRequest.GetEntireRawContent()
at System.Web.HttpRequest.FillInFormCollection()
at System.Web.HttpRequest.get_Form()
at System.Web.HttpRequest.get_HasForm()
at System.Web.UI.Page.GetCollectionBasedOnMethod(Boolean dontReturnNull)
at System.Web.UI.Page.DeterminePostBackMode()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint
我尝试在 web.config 中使用 HttpRuntime 节点的 maxRequestLength 属性,但它似乎无法控制。
作为测试用例,我尝试将其设置为 5K,但网页显示即使它更大(大约 150K),所以我猜它不允许显示巨大的网页。
有没有办法可以控制最大响应大小并避免“超出最大请求长度”错误?
如果它改变了我们使用 .Net 4.0 和 IIS 6.0 的任何内容
【问题讨论】: