I am using .NET Core 3.1 MVC with C# to a make web application. I want to allow users to upload files with the unlimited file size to my server.
I tried the following things:
https://github.com/dotnet/aspnetcore/issues/15431
Increase upload file size in Asp.Net core
Remember my main goal is allow to upload any file size.
I also tried
[HttpPost]
[ValidateAntiForgeryToken]
//[RequestFormLimits(MultipartBodyLengthLimit = 107374182400)] //100 GB
//[RequestSizeLimit(107374182400)]
//[DisableRequestSizeLimit, RequestSizeLimit(107374182400)]
public async Task<IActionResult> ImportDB(int t = 0)
{}
It works for Linux based server but not work for IIS server
My web.config file for 4 GB. I want unlimited file size.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!-- To customize the asp.net core module uncomment and edit the following section.
For more info see https://go.microsoft.com/fwlink/?linkid=838655 -->
<system.webServer>
<handlers>
<remove name="aspNetCore" />
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="InProcess" />
<!-- Add this section for file size... -->
<security>
<requestFiltering>
<!--Measured in Bytes-->
<requestLimits maxAllowedContentLength="4294967295" />
<!--4 GB-->
</requestFiltering>
</security>
</system.webServer>
</configuration>