leadgenius 发表于 2011-12-21 08:44

FileUpload上传文件过大出错

<DIV>上传文件时出现:</DIV>
<DIV> <BR>&nbsp; &nbsp; &nbsp; System.Web.HttpRequest.GetEntireRawContent() &nbsp; +895 <BR>&nbsp; &nbsp; &nbsp; System.Web.HttpRequest.GetMultipartContent() <BR>&nbsp; &nbsp; &nbsp; System.Web.HttpRequest.FillInFormCollection() &nbsp; +256 <BR>&nbsp; &nbsp; &nbsp; System.Web.HttpRequest.get_Form() &nbsp; +50 <BR>&nbsp; &nbsp; &nbsp; System.Web.UI.Page.GetCollectionBasedOnMethod() &nbsp; +70 <BR>&nbsp; &nbsp; &nbsp; System.Web.UI.Page.DeterminePostBackMode() &nbsp; +47 <BR>&nbsp; &nbsp; &nbsp; System.Web.UI.Page.ProcessRequestMain() &nbsp; +42 <BR>类似的东西。</DIV>
<DIV>&nbsp;</DIV>
<DIV>与web.config中的配置有关。</DIV>
<DIV>&nbsp;</DIV>
<DIV>添加或更改</DIV>
<DIV>&lt;httpRuntime&nbsp;&nbsp; maxRequestLength="524288000" useFullyQualifiedRedirectUrl = "true" executionTimeout="600" /&gt;</DIV>
<DIV>问题解决,好像默认文件大小4M,直接来个500M的。</DIV>
<DIV>&nbsp;</DIV>
<DIV>这里的executionTimeout是文件上传过程的时间,以秒为单位,这里限制600秒,超过时间而文件仍然没有上传完毕,则上传失败,默认是110秒,maxRequestLength是上传文件的大小,以KB为单位,默认值为 4096 (4 MB)。</DIV>
<DIV>其中httpRuntime的语法为:</DIV>
<DIV>&nbsp;</DIV>
<DIV>&lt;httpRuntime<BR>&nbsp;&nbsp; executionTimeout = "HH:MM:SS" <BR>&nbsp;&nbsp; maxRequestLength = "number" <BR>&nbsp;&nbsp; requestLengthDiskThreshold = "number" <BR>&nbsp;&nbsp; useFullyQualifiedRedirectUrl = "" <BR>&nbsp;&nbsp; minFreeThreads = "number" <BR>&nbsp;&nbsp; minLocalRequestFreeThreads = "number" <BR>&nbsp;&nbsp; appRequestQueueLimit = "number"<BR>&nbsp;&nbsp; enableKernelOutputCache = "" <BR>&nbsp;&nbsp; enableVersionHeader = "" <BR>&nbsp;&nbsp; apartmentThreading = ""<BR>&nbsp;&nbsp; requireRootedSaveAsPath = ""<BR>&nbsp;&nbsp; enable = "" <BR>&nbsp;&nbsp; sendCacheControlHeader = "" <BR>&nbsp;&nbsp; shutdownTimeout = "HH:MM:SS"<BR>&nbsp;&nbsp; delayNotificationTimeout = "HH:MM:SS"<BR>&nbsp;&nbsp; waitChangeNotification = "number" <BR>&nbsp;&nbsp; maxWaitChangeNotification = "number" <BR>&nbsp;&nbsp; enableHeaderChecking = "" <BR>/&gt;</DIV>
<DIV><BR>位置在system.web标签内,可参考</DIV>
<DIV><A href="http://blogold.chinaunix.net/u/2244/showart.php?id=2546686">http://blogold.chinaunix.net/u/2244/showart.php?id=2546686</A></DIV>
<DIV></DIV>
页: [1]
查看完整版本: FileUpload上传文件过大出错