在使用 HttpFileCollection files = context.Request.Files; 这句话的时候,如果上传文件太大,会报错,且无法上传,其原因是默认文件大小是10M左右,超过就会报错,如果我们想扩大上传内容可以这样:
在web.config中添加两处代码方能生效:
第一处:
<httpRuntime targetFramework="4.5.2" maxRequestLength="204800" executionTimeout="3600" />
我这设置的大小为200M
第二处:
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="1073741824"/>
</requestFiltering>
</security>
这样就不会报错了,大文件也能上传啦,貌似最大扩张到2G.。。。