今天用户反映,Gridview无法导出Excel,一些电脑出现"Maximum request length exceeded"错误,
Server Error in '/' Application.Maximum request length exceeded.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: Maximum request length exceeded.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. |
或是一些电脑导出时,网页无法显示,
刚开始,Insus.NET还是想到是不是记录太多,超过Excel的限制65536条记录,它导出至Word也是出现同样的错误。这让Insus.NET想起asp.net上传文件时,也有大小的限制,难道导出文件也有这样限制吗?
不管怎样,先去配置web.config:
<system.web>
<httpRuntime maxRequestLength="102400" useFullyQualifiedRedirectUrl="true" minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="100" enableVersionHeader="true"/>
</system.web>
</configuration>
程序终于正常跑了,整个报表有70多MB大小。