問(wèn)題描述
可能重復(fù):
如何在 ASP 中增加最大上傳文件大小.NET?
我正在嘗試驗(yàn)證用戶上傳的上傳內(nèi)容,如果我們上傳小于 2 MB 的內(nèi)容,它可以正常工作,但如果我們上傳大于 2 MB 的內(nèi)容,我們會(huì)收到錯(cuò)誤連接已重置".
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?
推薦答案
如果您要上傳文件,請(qǐng)將其設(shè)置為 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 是以秒為單位的超時(shí).根據(jù)需求設(shè)置此值.
where maxRequestLength is the file size limit in KB and executionTimeout is the timeout in seconds. Set this value as per the requirement.
這篇關(guān)于如何在使用 asp.net 4.0 創(chuàng)建的網(wǎng)站上上傳超過(guò) 2 MB 的內(nèi)容的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!