Asp.net mvc 4 尽管设置了配置值,但已超过最大请求长度

Asp.net mvc 4 尽管设置了配置值,但已超过最大请求长度,asp.net-mvc-4,file-upload,web-config,blobstorage,maxrequestlength,Asp.net Mvc 4,File Upload,Web Config,Blobstorage,Maxrequestlength,当使用我正在使用的MVC应用程序将大于4MB的文件上载到blob存储时,我遇到了一些问题。我在web.config中添加了必要的代码,如下所示: 在system.web中 <httpRuntime maxRequestLength="1048576" executionTimeout="3600" /> 在system.webserver中 <security> <requestFiltering> <requestLimits max

当使用我正在使用的MVC应用程序将大于4MB的文件上载到blob存储时,我遇到了一些问题。我在web.config中添加了必要的代码,如下所示:

在system.web中

<httpRuntime maxRequestLength="1048576" executionTimeout="3600" />

在system.webserver中

<security>
  <requestFiltering>
    <requestLimits maxAllowedContentLength="1073741824" />
  </requestFiltering>
</security>

我已经重建了我的web项目和azure项目,但我仍然获得了超出最大请求长度的错误。你知道这是什么原因吗?堆栈跟踪如下所示:

[HttpException(0x80004005):超出最大请求长度。] System.Web.HttpRequest.GetEntireRawContent()+12603644 System.Web.HttpRequest.GetMultipartContent()+221 System.Web.HttpRequest.FillInFormCollection()+357 System.Web.HttpRequest.exe()+110 System.Web.HttpRequest.get_Form()+16 System.IdentityModel.Services.WSFederationAuthenticationModule.IsSignInResponse(HttpRequestBase请求)+32 System.IdentityModel.Services.WSFederationAuthenticationModule.CanReadSignInResponse(HttpRequestBase请求,第页布尔值)+129 System.IdentityModel.Services.WSFederationAuthenticationModule.OnAuthenticateRequest(对象发送方,事件参数)+152 System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()+80
System.Web.HttpApplication.ExecuteStep(IExecutionStep步骤,布尔值&同步完成)+165

我也遇到过类似的问题,这个问题很愚蠢

在my web.config中,已经指定了targetFramework属性的httpRuntime标记


我创建了第二个httpRuntime标记,而不是在已经存在的httpRuntime标记中添加maxRequestLength。因此,我的值被忽略。

可能与的重复。您找到解决方案了吗?我尝试了您的代码,它对我有效。视图文件夹中有一个web.config文件。您可能错误地更改了它,而不是更改项目根路径中的Web.Config