虽然上传大文件得到错误 [英] While uploading large files getting error

查看:99
本文介绍了虽然上传大文件得到错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用.NET 4.5。我设置的配置文件为100 MB的最大请求长度和 maxAllowedContentLength 。当我尝试上载大于100 MB的文件(如200MB到1000MB)我得到一个错误

I am using .net 4.5. I set maximum request length and maxAllowedContentLength in config file as 100 mb. When I try to upload larger than 100 mb file (like 200mb to 1000mb) I am getting an error

The request filtering module is configured to deny a request that exceeds the request content length

这是正常的,预期的错误,但是当我尝试大于1 GB,我得到错误Internet Explorer无法显示网页。

This is normal and expected error but when I try to larger than 1 gb, I am getting error "internet explorer cannot display page".

我认为这是由于超时问题,但我真的无法弄清楚这个错误的实际原因。

I think it is due to a timeout issue but I really can't figure out actual reason of this error.

感谢ü。

推荐答案

这已经被问在计算器上许多倍。我会继续的传统:)对于较大的上载,你需要设置两个参数:

This has been asked about on StackOverflow many times. I'll continue the tradition :) For large uploads you need to set two parameters:


  • maxAllowedContentLength 字节测量,所以确保你实际上已经正确设置。要允许上传1GB,它应该是134217728。

  • maxAllowedContentLength is measured in bytes, so make sure you've actually set it correctly. To allow 1GB uploads, it should be 134217728.

您还需要配置 的maxRequestLength 以及maxAllowedContentLength。但是请注意,这是的以KB为单位测,所以这将是不同的。

You also need to configure maxRequestLength as well as maxAllowedContentLength. Note though that it is measured in kilobytes, so it will be different.

例如:

<configuration>
    <system.web>
        <httpRuntime maxRequestLength="1048576" />
    </system.web>
</configuration>

<system.webServer>
    <security>
        <requestFiltering>
            <requestLimits maxAllowedContentLength="1073741824" />
        </requestFiltering>
    </security>
</system.webServer>

这篇关于虽然上传大文件得到错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆