dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.43k stars 10.02k forks source link

It's 2023 year of our lord and I still can't upload a file larger than 4GB? #52498

Closed catmanjan closed 11 months ago

catmanjan commented 11 months ago

Is there an existing issue for this?

Is your feature request related to a problem? Please describe the problem.

I am trying to upload a file larger than 4GB on a Windows server, but I can't - compare that to Google Drive which has a max upload size of 5120GB

Describe the solution you'd like

I should be able to upload any size file that will fit on my server.

Additional context

No response

danmoseley commented 11 months ago

Hello, can you show a snippet of code?

catmanjan commented 11 months ago

@danmoseley not really - but there is this doco https://learn.microsoft.com/en-us/previous-versions/iis/settings-schema/ms689462(v=vs.90)?redirectedfrom=MSDN

danmoseley commented 11 months ago

Ok putting in area-runtime and someone with context can give guidance.

david-acker commented 11 months ago

Are there any particular errors you get when uploading a file larger than 4GB?

The MaxRequestBodySize feature uses a long so, in theory, you should be able to set a limit larger than 4GB.

Perhaps this could be related? #2711

catmanjan commented 11 months ago

@david-acker not really - it just doesn't respond

I think this is a long standing historical issue with IIS https://stackoverflow.com/questions/699488/file-upload-of-more-than-4gb

image

BrennanConroy commented 11 months ago

ASP.NET Core has no control over IIS settings. It looks like IIS uses a uint for its setting which is equivalent to 4GB. IIS feature feedback can be posted at https://social.msdn.microsoft.com/Forums/en-US/home?forum=iisfeaturefeedback.

If you want to upload more than 4GB you can use Kestrel instead which uses a .NET long so will support a much larger file size. You can see https://learn.microsoft.com/aspnet/core/mvc/models/file-uploads?view=aspnetcore-8.0#server-and-app-configuration for details on configuring the limits in ASP.NET Core.

As a side note, the stackoverflow post you linked has multiple people mentioning that uploading large files would probably be better if you chunked it up so that if the connection goes down in the middle of uploading it can resume where it left off instead of starting over from the beginning.