我有一个类似的问题:如何在IIS7上运行时将maxAllowedContentLength设置为500MB?
区别在于我已经修改了我web.config接受的文件大小达到2 Gb但是当尝试上传大文件时,我收到以下错误:
请求过滤模块被配置为拒绝超过内容长度的请求.
我web.config是这样的:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<httpRuntime executionTimeout="999999" maxRequestLength="2097151"/>
<customErrors mode="Off"/>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.0" />
<membership>
<providers>
<clear/>
</providers>
</membership>
<profile>
<providers>
<clear/>
</providers>
</profile>
<roleManager enabled="false">
<providers>
<clear/>
</providers>
</roleManager>
</system.web>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="2097151" />
</requestFiltering>
</security>
</system.webServer>
Run Code Online (Sandbox Code Playgroud)
当我尝试上传文件时,我仍然收到错误131 MB.
那么,我应该在maxAllowedContentLength设置中设置什么才能让人们上传超过100 MB的文件呢?
虽然MaxRequestLength是数千字节,maxAllowedContentLength是数个字节.将其再次乘以1024,它应该可以正常工作.
maxAllowedContentLength
可选的uint属性.
指定请求中内容的最大长度(以字节为单位).
默认值为30000000.
http://msdn.microsoft.com/en-us/library/ms689462(v=vs.90).aspx
| 归档时间: |
|
| 查看次数: |
11614 次 |
| 最近记录: |