我一直在尝试将大于2 mb的文件上传到运行在带有IIS 8的Windows 2012服务器上的网站。我可以上传2 mb以下的文件,所以这不是超时问题,任何超过2 mb的文件都会导致它拒绝文件(任何扩展名)。
到目前为止,我所做的是将默认值更改为:
<httpRuntime maxRequestLength="153600" executionTimeout="900" />
<requestFiltering allowDoubleEscaping="true">
<requestLimits maxAllowedContentLength="157286400" />
</requestFiltering>
ASP Max request Entity Body Limit to 20000000
根据我所读到的内容,maxRequestLength以KB为单位,maxAllowedContentLength以字节为单位,应该大于maxRequestLength,ASP最大请求实体体限制也以字节为单元。
遗憾的是,这些变化并没有解决问题。
是否修改了web.config中的maxAllowedContentLength设置?
您可以通过修改web.config文件中的maxAllowedContentLength设置来增加最大文件大小,如下例所示:
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="2147483648" />
</requestFiltering>
</security>
</system.webServer>
现在,您可以上传大小为2GB的文件。