当你想要上传时,文件过大,报413时,有两种解决方案,这两种解决方案任选其一就可以。
一、在web.config上配置,按照以下格式,将下列标红加粗的地方,按照对应位置复制到web.config中,即可解决。
注:这两个标红处均要复制,配置!!!
httpRuntime 中 maxRequestLength就是设置你上传文件的大小限制;
requestLimits 中 maxAllowedContentLength就是设置你上传文件的大小限制;
<configuration> <system.web> <compilation targetFramework="4.6.1" /> <httpRuntime executionTimeout="600" maxRequestLength="419430400" targetFramework="4.6.1" /> </system.web> <system.webServer> <security> <requestFiltering> <requestLimits maxAllowedContentLength="419430400" /> </requestFiltering> </security> </system.webServer> </configuration>
二、IIS中配置
打开IIS,找到文件上传的项目,选中->功能试图->配置编辑器(如下图)