5

我有一个类似的问题:How to set the maxAllowedContentLength to 500MB while running on IIS7?

不同之处在于我已经修改了我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>

当我尝试上传一个只有它的文件时,我仍然收到错误消息131 MB

那么,我应该在设置中maxAllowedContentLength设置什么以允许人们上传超过 100 MB 的文件?

4

2 回答 2

12

WhileMaxRequestLength千字节数,maxAllowedContentLength字节数。再乘以 1024,它应该可以正常工作。

maxAllowedContentLength
可选的 uint 属性。
指定请求中内容的最大长度,以字节为单位。
默认值为 30000000。
http://msdn.microsoft.com/en-us/library/ms689462(v=vs.90).aspx

于 2012-10-30T18:37:03.787 回答
2

在 Windows 运行 (WinKey + r) 中键入inetmgr,单击左侧面板上的服务器名称,然后在IIS部分的右侧面板中双击请求过滤。在最右侧的面板上单击编辑功能设置...。在请求限制部分,您可以更改maxAllowedContentLength

如果您只想在其中一个站点中更改maxAllowedContentLength,请在左侧面板中的站点下选择您的站点,然后按照与上述相同的方式进行更改。

于 2015-09-25T10:35:52.947 回答