0
votes

I am working with Asp.Net Core 5.0 Web Api and IIS 10, I need to get file size unlimited to my Api, I have read a lot OF solutions

Increase upload file size in Asp.Net core

and l understand all of the solution(because the restriction of IIS) I need to add web.config as below

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

but still I have a problem because the maxAllowedContentLength = uint/4294967295 and I want to upload unlimited file and this solution solve for 4GB and not more.

If anyone have any idea please help.

Thanks.

1
Why assume you want even that? How long is it going to upload 4GB? What are the chances that such a long upload will get interrupted? What are the chances that some part of the file will get corrupted? And what will happen to your site if you try to load a 4GB-long byte[] buffer? Sending an infinite stream of random bytes to a site is one of the easiest and oldest Denial-of-Service attacksPanagiotis Kanavos
There's a reason all cloud providers work with blocks instead of entire GB-sized files, and why all web servers limit upload sizes. On the one hand, without request filtering a hacker can bring down the site by simply feeding it with random bytes. On the other hand, it's way too easy to get interruptions and corrupted data with such long uploads. While you can turn off request filtering altogether, you really, really don't want toPanagiotis Kanavos
File upload and download managers typically transfer file using chunks. This way, they can restart uploads or downloads, and even transfer chunks in parallel. Check Range requestsPanagiotis Kanavos
First of all thank you, I understand from you that not recommended to upload unlimited file, the correct way to do it is the with chunks ? actually functionality of chunks should be on client side and server side should support it?Y F
Agree with Panagiotis, you could upload large files using chunks. On the client side, you could split the large file into chunks, then send them to the server side using multiple requests. On the server sides, receive the chunks and merge the file. Refer this article. Besides, if you are upload the file to the Azure storage, you could try to use the storage JS SDK, it contains the method to upload files with chunks, see this thread.Zhi Lv

1 Answers

0
votes

In IIS configuration (or your web.config), check (or add) the UploadReadAheadSize value and increase it to a value that matches your requirement.