如何在使用 asp.net 4.0 创建的网站上上传超过 2 MB 的内容 [英] How to upload content more than 2 MB's on website created using asp.net 4.0

查看:30
本文介绍了如何在使用 asp.net 4.0 创建的网站上上传超过 2 MB 的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
如何在 ASP 中增加最大上传文件大小.NET?

我正在尝试验证用户上传的上传内容,如果我们上传小于 2 MB 的内容,它可以正常工作,但如果我们上传大于 2 MB 的内容,我们会收到错误连接已重置".

i m trying to validate an uploaded content uploaded by user, it works fine if we upload content lesser than 2 MB's, but if we upload content more than 2MB's, withour undergoing any process, we get an error "Connection is reset."

是否存在以及为什么要增加 asp.net web.config 文件中的限制?

is there and why to increase the limit in asp.net web.config file?

推荐答案

如果您要上传文件,请将其设置为 system.web 部分下的 Web.Config

If you are trying to upload a file, set this to Web.Config under system.web section

  <httpRuntime maxRequestLength="51200" executionTimeout="3600" />

其中 maxRequestLength 是以 KB 为单位的文件大小限制,而 executionTimeout 是以秒为单位的超时.根据需求设置此值.

where maxRequestLength is the file size limit in KB and executionTimeout is the timeout in seconds. Set this value as per the requirement.

这篇关于如何在使用 asp.net 4.0 创建的网站上上传超过 2 MB 的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆