How to upload files over 2Gb to IIS 7.5 / .Net 4?

我是研究僧i 提交于 2019-12-10 04:04:56

问题


As far as I know IIS and ASP.NET has a limitation of 2Gb files upload. Are there any solutions for this in IIS 7.5 and .Net 4?


回答1:


I found a blog post that explains the cryptic error "ASP.NET detected invalid characters in the URL."

From the blog post:

When the integrated pipeline is used, we go though webengine code (webengine4!MgdGetRequestBasics) which doesn't support more than 2 GB content-length and a System.ArithmeticException exception is raised which subsequently cause the HTTP 400 error. With the classic pipeline, we don't use webengine4 but the old ASPNET_ISAPI model and we don't hit the above issue.

The post also describes how the author was able to upload files larger than 2 gigs.




回答2:


Have a look here.

You have to add to your application's web.config the following code:

<system.webServer>
<security>
    <requestFiltering>
        <requestLimits maxAllowedContentLength ="2147482624" /><!--this value in bytes~2GB-->
    </requestFiltering>
</security>
<system.webServer>

Also in web.config find the system.web section and the httpRuntime key and modify the maxRequestLength and executionTimeout attributes of this key as mentioned in the reference I gave you.

I hope this works for you.



来源:https://stackoverflow.com/questions/6802519/how-to-upload-files-over-2gb-to-iis-7-5-net-4

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