简体   繁体   English

如何更改IIS 7.0的maxAllowedContentLength?

[英]How to change the maxAllowedContentLength of IIS 7.0?

Ii have a problem similar to: How to set the maxAllowedContentLength to 500MB while running on IIS7? 我有一个类似的问题: 在IIS7上运行时如何将maxAllowedContentLength设置为500MB?

The difference is that I have already modified my web.config to accept files upto 2 Gb in size but when try and upload a large file, I get the following error: 区别在于我已经修改了web.config来接受最大2 Gb的文件,但是当尝试上传大文件时,出现以下错误:

The request filtering module is configured to deny a request that exceeds the length of the content. 请求过滤模块被配置为拒绝超过内容长度的请求。

my web.config is this: 我的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>

I still receive the error when i try to upload a file that it is only 131 MB . 尝试上传仅131 MB的文件时,我仍然收到错误消息。

So, what should I set in the maxAllowedContentLength settings to allow people to upload files over 100 MB please? 因此,我应该在maxAllowedContentLength设置中设置什么以允许人们上传超过100 MB的文件?

While MaxRequestLength is number of kilobytes , maxAllowedContentLength is number of bytes . MaxRequestLength千字节数,而maxAllowedContentLength字节数 Multiply it again by 1024, and it should work fine. 再次将其乘以1024,它应该可以正常工作。

maxAllowedContentLength maxAllowedContentLength
Optional uint attribute. 可选的uint属性。
Specifies the maximum length of content in a request, in bytes. 指定请求中内容的最大长度,以字节为单位。
The default value is 30000000. 默认值为30000000。
http://msdn.microsoft.com/en-us/library/ms689462(v=vs.90).aspx http://msdn.microsoft.com/zh-cn/library/ms689462(v=vs.90).aspx

Type inetmgr in windows Run (WinKey + r) click your server name on left panel and in right panel in IIS section double click Request Filtering. 在Windows Run(WinKey + r)中键入inetmgr ,在左侧面板上单击服务器名称,然后在IIS部分的右侧面板中,双击“请求筛选”。 on the rightest panel click Edit Feature Settings... . 在最右侧的面板上,单击“ 编辑功能设置...” In Request Limits section you can change the maxAllowedContentLength . 在“ 请求限制”部分中,您可以更改maxAllowedContentLength

If you want change maxAllowedContentLength just in one of your sites, on the left panel select your site under Sites and go the same way as above to change it. 如果你想只是在你的网站的一个变化maxAllowedContentLength,左侧面板中选择您的站点下站点和同路如上去改变它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM