Search code examples
c#asp.net-mvc.net-coreasp.net-mvc-5

Maximum request length exceeded in DOT NETCORE MVC c#


I am working on DOT NET CORE MVC C# Project.

I am getting the error when I am trying to upload a video of size 500MB or 1GB to my site. How do I fix this?

After searching on web perform two task but still failed to upload.

Size: = MAX VIDEO SIZE 3GB

TRIED CODE

<httpRuntime maxRequestLength="SIZE_DETAILS" requestValidationMode="2.0" enableVersionHeader="false"  />

TRIED CODE

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


Solution

  • For 500mb videos use the code below:

    <httpRuntime maxRequestLength="2147483647" />
    

    In simple terms you even need a higher memory but for images and videos around 2.5MB this will fix it. Anything higher will require a higher maxRequestLength.

    Or even increase it to something like

    <httpRuntime maxRequestLength="22147483647" />
    

    I used this to handle pictures that are higher and manipulate by reducing the image size in code and it worked.