简体   繁体   English

ASP.NET MVC:尽管在 web.config 中设置了 maxRequestLength maxAllowedContentLength,但仍超出了最大请求长度

[英]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:我试图解决这个问题的事情:

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使用maxRequestLengthmaxAllowedContentLength对其进行编辑

then copy the file back into the directory.然后将文件复制回目录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM