While uploading large files getting error

ぃ、小莉子 提交于 2019-12-12 00:00:51

问题


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

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.

Thank u.


回答1:


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

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

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

For example:

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

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



回答2:


It's a little unclear, but what I think you're running into is IIS's normal behavior reguarding exceptions: any issue with the request returns a 500 server error response.

In oder to view exceptions you can either disable this behavior in the configuration file (MSDN Link), or transfer the file while logged into the server (connections from localhost bypass this behavior by default).



来源:https://stackoverflow.com/questions/15398002/while-uploading-large-files-getting-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!