Reputation: 103
I've been trying to upload a file larger than 4mb to an ASP.NET MVC web application (for a long time) and I've looked at so many stack exchange articles so I am aware this is a duplicate, but I've tried everything I'm not making any progress.
I'm running Visual Studio 2019 16.3.9 / IISExpress 10.0 / .NET 4.5.2.
The following code has been added
<location path="UploadedAudio">
<system.web>
<httpRuntime executionTimeout="3600" maxRequestLength="1048576" />
</system.web>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="1073741824" />
</requestFiltering>
</security>
</system.webServer>
</location>
Things I've tried to resolve the issue:
adding the above code to all of the below files (individually & all together) -
~/View/web.config
~/web.Debug.config
~/web.config
I've tried this without <location>
.
Windows features - Request Filtering on - https://learn.microsoft.com/en-us/iis/configuration/system.webserver/security/requestfiltering/requestlimits/
From what I've read it's means to be in - 'View/web.config'
I've read that adding the above code to the following file could work:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\web.config
Setting maxRequestLength
lower than maxAllowedContentLength
But nothing seems to work for me. Are there any considerations for running in debug mode in Visual Studio that I'm missing?
Any help would or corrections would be greatly appreciated!
Upvotes: 0
Views: 1338
Reputation: 103
I had to copy this -
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\web.config
edit it with the maxRequestLength
and maxAllowedContentLength
then copy the file back into the directory.
Upvotes: 0