在aspx网页上传文件时,文件超出一定大小,有可能会因为iis的设置而导致文件无法上传,因为在iis默认配置中对文件上传具有限制.
解决方法:
//设置Web.Config
设置节点
maxRequestLength="2097151" 文件的大小设置为2g
<system.web>
<httpRuntime targetFramework="4.5" maxRequestLength="2097151" executionTimeout="120"/>
</system.web>
maxAllowedContentLength 允许的最大内容长度设置(字节)
maxUrl 最大URL长度(字节)
设置太小会出现问题(请求筛选模块被配置为拒绝超过请求内容长度的请求)
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="1048576000" maxUrl="1048576000" />
</requestFiltering>
</security>
</system.webServer>
本文介绍了解决IIS中大文件上传限制的方法,通过修改Web.Config中的maxRequestLength和maxAllowedContentLength参数,可以有效提升文件上传的大小限制,避免因IIS默认设置导致的上传失败。
4336

被折叠的 条评论
为什么被折叠?



