mvc4文件上传由于文件太大而无法正常获取文件

id="cproIframe_u1513042_1" width="1000" height="90" src="http://pos.baidu.com/acom?adn=0&at=128&aurl=&cad=1&ccd=24&cec=UTF-8&cfv=16&ch=0&col=zh-cn&conOP=0&cpa=1&dai=1&dis=0&layout_filter=rank&ltr=http%3A%2F%2Fwww.baidu.com%2Flink%3Furl%3DHZvzjx-5-hF_ja9Sk76MRzi4pxLB18k4hCRhERa4_qSUKebWiTh9ELp-niTGN10INjx1MFQddUvRXSgZoEDWbKn6UQyYnIs9X5heGPoXF9jvnTJoKmYKKxSP04iGFI2nkWwQEMlASgNeIC-uTN9hKK%26wd%3DHttpPostedFileBase%2520%25E5%25A4%25A7%25E6%2596%2587%25E4%25BB%25B6%26issp%3D1%26f%3D8%26ie%3Dutf-8%26tn%3Dbaiduhome_pg%26inputT%3D8054&ltu=http%3A%2F%2Fwww.makaidong.com%2F%25E5%258D%259A%25E5%25AE%25A2%25E5%259B%25AD%25E7%259F%25A5%25E8%25AF%2586%25E5%25BA%2593%2F14197.shtml&lunum=6&n=00057180_cpr&pcs=910x423&pis=10000x10000&ps=110x11&psr=1366x768&pss=910x110&qn=c23b73c2757f0140&rad=&rsi0=1000&rsi1=90&rsi5=4&rss0=&rss1=&rss2=&rss3=&rss4=&rss5=&rss6=&rss7=&scale=&skin=tabcloud_skin_1&stid=5&td_id=1513042&tn=baiduCustSTagLinkUnit&tpr=1425632889894&ts=1&version=2.0&xuanting=0&dtm=BAIDU_DUP2_SETJSONADSLOT&dc=2&di=u1513042&tt=1425632889875.23.82.83" align="center,center" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" allowtransparency="true" style="margin: 0px; padding: 0px; border-width: 0px; outline: 0px; background: transparent;">
当前位置: 首页 →  博客园知识库 → 文件上传System.Web.HttpException:超过了最大请求长度

文件上传System.Web.HttpException:超过了最大请求长度

  作者及来源: NoteBooks - 博客园      收藏到 →_→:
摘要: [文件上传]System.Web.HttpException: 超过了最大请求长度
"文件上传System.Web.HttpException:超过了最大请求长度":
关键词 文件  上传  system.web.httpexception    过了  最大  请求  长度

id="cproIframe_u1603290_2" width="640" height="140" src="http://pos.baidu.com/acom?adn=0&at=128&aurl=&cad=1&ccd=24&cec=UTF-8&cfv=16&ch=0&col=zh-cn&conBW=0&conOP=1&cpa=1&dai=2&dis=0&hn=0&layout_filter=tabcloud&ltr=http%3A%2F%2Fwww.baidu.com%2Flink%3Furl%3DHZvzjx-5-hF_ja9Sk76MRzi4pxLB18k4hCRhERa4_qSUKebWiTh9ELp-niTGN10INjx1MFQddUvRXSgZoEDWbKn6UQyYnIs9X5heGPoXF9jvnTJoKmYKKxSP04iGFI2nkWwQEMlASgNeIC-uTN9hKK%26wd%3DHttpPostedFileBase%2520%25E5%25A4%25A7%25E6%2596%2587%25E4%25BB%25B6%26issp%3D1%26f%3D8%26ie%3Dutf-8%26tn%3Dbaiduhome_pg%26inputT%3D8054&ltu=http%3A%2F%2Fwww.makaidong.com%2F%25E5%258D%259A%25E5%25AE%25A2%25E5%259B%25AD%25E7%259F%25A5%25E8%25AF%2586%25E5%25BA%2593%2F14197.shtml&lu_161=32&lunum=6&n=00057180_cpr&pcs=896x409&pis=10000x10000&ps=483x11&psr=1366x768&pss=1011x483&qn=ab76f35acbeaf7d8&rad=&rsi0=640&rsi1=140&rsi5=4&rss0=%23FFFFFF&rss1=%23FFFFFF&rss2=%230000FF&rss3=&rss4=&rss5=&rss6=%23e10900&rss7=&scale=&skin=&td_id=1603290&titFF=%E5%AE%8B%E4%BD%93&titFS=12&titTA=left&tn=baiduTlinkInlay&tpr=1425632889894&ts=1&version=2.0&wn=0&xuanting=0&dtm=BAIDU_DUP2_SETJSONADSLOT&dc=2&di=u1603290&tt=1425632889875.151.202.202" align="center,center" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" allowtransparency="true" style="margin: 0px; padding: 0px; border-width: 0px; outline: 0px; background: transparent;">

错误信息

“/”应用程序中的服务器错误。


超过了最大请求长度。

说明: 执行当前 web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 

异常详细信息: system.web.httpexception: 超过了最大请求长度。

源错误: 

行 2:      string path = "";
行 3:      layout = null;
行 4:      if (request.files.count > 0)
行 5:      {
行 6:          httppostedfilebase file = request.files["file"];


源文件: e:\ymy\mvc3\mvc3study\udm\views\users\uploadfile.cshtml    行: 

堆栈跟踪: 

[httpexception (0x80004005): 超过了最大请求长度。]
   system.web.httprequest.getentirerawcontent() +11482135
   system.web.httprequest.getmultipartcontent() +232
   system.web.httprequest.fillinfilescollection() +73
   system.web.httprequest.get_files() +221
   system.web.httprequestwrapper.get_files() +18

 

 

错误截图

 

 

发生原因

在上传文件时发生了错误提示

 

解决方案

这是因为asp.net默认限制最大上传文件大小为4096kb,而我上传了6000kb+所以超出了限制,需要修改项目的web.config文件即可解决,可以将最大文件长度设置为你需要的长度,我这里设置为:1024*10kb=10mb

1 <configuration>
2   <system.web>
3      <httpruntime maxrequestlength="10240" />
4   </system.web>
5 <configuration>

 

 


搜索此文相关文章: 文件上传System.Web.HttpException:超过了最大请求长度
此文链接: http://www.makaidong.com/%E5%8D%9A%E5%AE%A2%E5%9B%AD%E7%9F%A5%E8%AF%86%E5%BA%93/14197.shtml
转载请注明出处: 文件上传System.Web.HttpException:超过了最大请求长度 - 博客园

id="starIframe1" src="http://inte.sogou.com/ct?id=331835&h=60&w=640&fv=16&if=16&sohuurl=http%3A%2F%2Fwww.makaidong.com%2F%25E5%258D%259A%25E5%25AE%25A2%25E5%259B%25AD%25E7%259F%25A5%25E8%25AF%2586%25E5%25BA%2593%2F14197.shtml&refer=http%3A%2F%2Fwww.baidu.com%2Flink%3Furl%3DHZvzjx-5-hF_ja9Sk76MRzi4pxLB18k4hCRhERa4_qSUKebWiTh9ELp-niTGN10INjx1MFQddUvRXSgZoEDWbKn6UQyYnIs9X5heGPoXF9jvnTJoKmYKKxSP04iGFI2nkWwQEMlASgNeIC-uTN9hKK%26wd%3DHttpPostedFileBase%2520%25E5%25A4%25A7%25E6%2596%2587%25E4%25BB%25B6%26issp%3D1%26f%3D8%26ie%3Dutf-8%26tn%3Dbaiduhome_pg%26inputT%3D8054&rnd=101c40f34118a5b0&z=183407d759c36a68&lmt=1398100865&srp=1366,768&ccd=24&lhi=1&eja=true&npl=49&nmi=61&ece=true&lan=zh-cn&bi=1&t1=20&t2=1425632890&pvt=1425632890174&ssi0=259&ti=%E6%96%87%E4%BB%B6%E4%B8%8A%E4%BC%A0System.Web.HttpException%3A%E8%B6%85%E8%BF%87%E4%BA%86%E6%9C%80%E5%A4%A7%E8%AF%B7%E6%B1%82%E9%95%BF%E5%BA%A6%20-%20%E5%8D%9A%E5%AE%A2%E5%9B%AD&bs=896,409&tmp_cdif=0&m=MTQyNTYzMjg4N19wcmV0dHkgZG9nXzMzMTgzNQA-&ex=" width="640" height="60" align="center,center" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" allowtransparency="true" style="margin: 0px; padding: 0px; border-width: 0px; outline: 0px; background: transparent;">

此文来自: 马开东博客 网址:http://www.makaidong.com 站长QQ 站长QQ420434200,点击确定开始回话! 赞助本站如果您想赞助本站长期发展,可以给站长 马开东 捐款,谢谢您的支持,我们会一如既往的努力,点击确认捐赠

id="cproIframe_u1513140_3" width="468" height="15" src="http://pos.baidu.com/acom?adn=0&at=128&aurl=&cad=1&ccd=24&cec=UTF-8&cfv=16&ch=0&col=zh-cn&conOP=0&cpa=1&dai=3&dis=0&layout_filter=tabcloud%2Cimage&ltr=http%3A%2F%2Fwww.baidu.com%2Flink%3Furl%3DHZvzjx-5-hF_ja9Sk76MRzi4pxLB18k4hCRhERa4_qSUKebWiTh9ELp-niTGN10INjx1MFQddUvRXSgZoEDWbKn6UQyYnIs9X5heGPoXF9jvnTJoKmYKKxSP04iGFI2nkWwQEMlASgNeIC-uTN9hKK%26wd%3DHttpPostedFileBase%2520%25E5%25A4%25A7%25E6%2596%2587%25E4%25BB%25B6%26issp%3D1%26f%3D8%26ie%3Dutf-8%26tn%3Dbaiduhome_pg%26inputT%3D8054&ltu=http%3A%2F%2Fwww.makaidong.com%2F%25E5%258D%259A%25E5%25AE%25A2%25E5%259B%25AD%25E7%259F%25A5%25E8%25AF%2586%25E5%25BA%2593%2F14197.shtml&lu_161=0&lunum=6&n=00057180_cpr&pcs=896x409&pis=10000x10000&ps=2421x243&psr=1366x768&pss=1011x2473&qn=fe0d9a229f892fda&rad=&rsi0=468&rsi1=15&rsi5=4&rss0=%23FFFFFF&rss1=%23FFFFFF&rss2=%230000ff&rss3=&rss4=&rss5=&rss6=%230000ff&rss7=&scale=&skin=&td_id=1513140&tn=tlink_default_468_15&tpr=1425632889894&ts=1&version=2.0&xuanting=0&dtm=BAIDU_DUP2_SETJSONADSLOT&dc=2&di=u1513140&tt=1425632889875.338.394.394" align="center,center" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" allowtransparency="true" style="margin: 0px; padding: 0px; border-width: 0px; outline: 0px; background: transparent;">
allowtransparency="true" frameborder="0" scrolling="no" style="margin: 0px; padding: 0px; border-width: 0px; border-style: none; outline: 0px; float: none; display: block; overflow: hidden; z-index: 2147483646; height: 323px; width: 672px; background: none;">
id="starIframe2" src="http://inte.sogou.com/ct?id=331846&h=60&w=640&fv=16&if=16&sohuurl=http%3A%2F%2Fwww.makaidong.com%2F%25E5%258D%259A%25E5%25AE%25A2%25E5%259B%25AD%25E7%259F%25A5%25E8%25AF%2586%25E5%25BA%2593%2F14197.shtml&refer=http%3A%2F%2Fwww.baidu.com%2Flink%3Furl%3DHZvzjx-5-hF_ja9Sk76MRzi4pxLB18k4hCRhERa4_qSUKebWiTh9ELp-niTGN10INjx1MFQddUvRXSgZoEDWbKn6UQyYnIs9X5heGPoXF9jvnTJoKmYKKxSP04iGFI2nkWwQEMlASgNeIC-uTN9hKK%26wd%3DHttpPostedFileBase%2520%25E5%25A4%25A7%25E6%2596%2587%25E4%25BB%25B6%26issp%3D1%26f%3D8%26ie%3Dutf-8%26tn%3Dbaiduhome_pg%26inputT%3D8054&rnd=101c40f34118a5b0&z=56e56160dda81b2b&lmt=1398100865&srp=1366,768&ccd=24&lhi=1&eja=true&npl=49&nmi=61&ece=true&lan=zh-cn&bi=2&t1=4&t2=1425632890&pvt=1425632890174&ssi0=259&ti=%E6%96%87%E4%BB%B6%E4%B8%8A%E4%BC%A0System.Web.HttpException%3A%E8%B6%85%E8%BF%87%E4%BA%86%E6%9C%80%E5%A4%A7%E8%AF%B7%E6%B1%82%E9%95%BF%E5%BA%A6%20-%20%E5%8D%9A%E5%AE%A2%E5%9B%AD&bs=896,409&tmp_cdif=0&m=MTQyNTYzMjg4OF9wcmV0dHkgZG9nXzMzMTg0NgA-&ex=" width="640" height="60" align="center,center" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" allowtransparency="true" style="margin: 0px; padding: 0px; border-width: 0px; outline: 0px; background: transparent;">
id="starIframe3" src="http://inte.sogou.com/ct?id=331847&h=250&w=300&fv=16&if=16&sohuurl=http%3A%2F%2Fwww.makaidong.com%2F%25E5%258D%259A%25E5%25AE%25A2%25E5%259B%25AD%25E7%259F%25A5%25E8%25AF%2586%25E5%25BA%2593%2F14197.shtml&refer=http%3A%2F%2Fwww.baidu.com%2Flink%3Furl%3DHZvzjx-5-hF_ja9Sk76MRzi4pxLB18k4hCRhERa4_qSUKebWiTh9ELp-niTGN10INjx1MFQddUvRXSgZoEDWbKn6UQyYnIs9X5heGPoXF9jvnTJoKmYKKxSP04iGFI2nkWwQEMlASgNeIC-uTN9hKK%26wd%3DHttpPostedFileBase%2520%25E5%25A4%25A7%25E6%2596%2587%25E4%25BB%25B6%26issp%3D1%26f%3D8%26ie%3Dutf-8%26tn%3Dbaiduhome_pg%26inputT%3D8054&rnd=101c40f34118a5b0&z=b0be9b99c5056cac&lmt=1398100865&srp=1366,768&ccd=24&lhi=1&eja=true&npl=49&nmi=61&ece=true&lan=zh-cn&bi=3&t1=11&t2=1425632891&pvt=1425632890174&ssi0=259&ti=%E6%96%87%E4%BB%B6%E4%B8%8A%E4%BC%A0System.Web.HttpException%3A%E8%B6%85%E8%BF%87%E4%BA%86%E6%9C%80%E5%A4%A7%E8%AF%B7%E6%B1%82%E9%95%BF%E5%BA%A6%20-%20%E5%8D%9A%E5%AE%A2%E5%9B%AD&bs=896,409&tmp_cdif=0&m=MTQyNTYzMjg4OF9wcmV0dHkgZG9nXzMzMTg0NwA-&ex=" width="300" height="250" align="center,center" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" allowtransparency="true" style="margin: 0px; padding: 0px; border-width: 0px; outline: 0px; background: transparent;">
1  2  3  4  5  6 

Powered by 自媒体人 马开东云搜索 Copyright © 2014-2020 www.makaidong.com, All
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值