[英]ASP.NET MVC : maximum request length exceeded despite maxRequestLength maxAllowedContentLength set in web.config
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.我一直在尝试将大于 4mb 的文件上传到 ASP.NET MVC Web 应用程序(很长一段时间)并且我查看了很多堆栈交换文章,所以我知道这是重复的,但我已经尝试了一切我没有取得任何进展。
I'm running Visual Studio 2019 16.3.9 / IISExpress 10.0 / .NET 4.5.2.我正在运行 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>
.我试过这个没有
<location>
。
Windows features - Request Filtering on - https://docs.microsoft.com/en-us/iis/configuration/system.webserver/security/requestfiltering/requestlimits/ Windows 功能 - 请求过滤 - https://docs.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'从我读到的意思是在 - '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
将
maxRequestLength
设置为低于maxAllowedContentLength
But nothing seems to work for me.但似乎没有什么对我有用。 Are there any considerations for running in debug mode in Visual Studio that I'm missing?
在 Visual Studio 中以调试模式运行时是否有任何我遗漏的注意事项?
Any help would or corrections would be greatly appreciated!任何帮助或更正将不胜感激!
I had to copy this - C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\web.config
我不得不复制这个 -
C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\web.config
edit it with the maxRequestLength
and maxAllowedContentLength
使用
maxRequestLength
和maxAllowedContentLength
对其进行编辑
then copy the file back into the directory.然后将文件复制回目录。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.