2011-12-22 15 views
5

Web.config dosyasında (her biri 20 MB) her iki maxRequestLength ve maxAllowedContentLength ayarını (alt bölgelerdeki (yani, Fields \ Administration \ Views) her ikisine de sahibim. Yönetimde dosya yükleme işlemi var ve büyük bir dosya yüklemeye çalıştığımda (~ 9MB bu durumda) "Maksimum istek uzunluğu aşıldı". Eğer iki ayarı köküne taşıyacak olursam işe yaramamayı tercih ederim. Baska öneri?ASP.NET MVC, bir alt klasör web.config dosyasında maxRequestLength ve maxAllowedContentLength göz ardı ediliyor mu?

Teknoloji: Windows Server 2008 Enterprise'da ASP.NET, .NET 4.0, MVC 3 ve IIS 7.

Yığın İzleme: sizin WebConfig dosyasında

[HttpException (0x80004005): Maximum request length exceeded.] 
    System.Web.HttpRequest.GetEntireRawContent() +11472119 
    System.Web.HttpRequest.GetMultipartContent() +232 
    System.Web.HttpRequest.FillInFormCollection() +345 
    System.Web.HttpRequest.get_Form() +157 
    Microsoft.Web.Infrastructure.DynamicValidationHelper.<>c__DisplayClass12.<ReplaceCollection>b__e() +63 
    Microsoft.Web.Infrastructure.DynamicValidationHelper.<>c__DisplayClass12.<ReplaceCollection>b__11() +20 
    Microsoft.Web.Infrastructure.DynamicValidationHelper.DeferredCountArrayList.get_Count() +20 
    System.Web.HttpRequest.ValidateNameValueCollection(NameValueCollection nvc, RequestValidationSource requestCollection) +34 
    System.Web.HttpRequest.get_Form() +212 
    System.Web.Mvc.HttpRequestExtensions.GetHttpMethodOverride(HttpRequestBase request) +160 
    System.Web.Mvc.AcceptVerbsAttribute.IsValidForRequest(ControllerContext controllerContext, MethodInfo methodInfo) +55 
    System.Linq.Enumerable.All(IEnumerable`1 source, Func`2 predicate) +149 
    System.Web.Mvc.ActionMethodSelector.RunSelectionFilters(ControllerContext controllerContext, List`1 methodInfos) +428 
    System.Web.Mvc.ReflectedControllerDescriptor.FindAction(ControllerContext controllerContext, String actionName) +140 
    System.Web.Mvc.ControllerActionInvoker.FindAction(ControllerContext controllerContext, ControllerDescriptor controllerDescriptor, String actionName) +27 
    System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +148 
    System.Web.Mvc.Controller.ExecuteCore() +159 
    System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +335 
    System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +62 
    System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +20 
    System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +54 
    System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +469 
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +375 
+1

, onu kabul edin cevap olarak. Aksi halde, sorununuz hakkında daha fazla bilgi vermek için yorum gönderin. –

cevap

7

, sen yolu bu şekilde <yeri> etiketi ilan etmek gerekir: cevabım size yardımcı oluyorsa

<location path="controller/action"> 
    <system.web> 
    <!-- maxRequestLength is in kilobytes (KB) --> 
    <httpRuntime maxRequestLength="5120" /> <!-- 5MB --> 
    </system.web> 
    <system.webServer> 
    <security> 
     <requestFiltering> 
     <!-- maxAllowedContentLength is in bytes (B) --> 
     <requestLimits maxAllowedContentLength="5242880"/> <!-- 5MB --> 
     </requestFiltering> 
    </security> 
    </system.webServer> 
</location> 
+0

Yani "VideoController" adlı bir denetleyici ve 'Kaydet 'adlı bir eylem var demektir, sonra ** yol ** için' yol = "Video/Kaydet" 'ayarlamanız gerekir? ASP.NET Web API'sından bahsediyorum. –

+0

WebAPI yolundan emin değil. Bu çözüm MVC içindi. Belki "api/controller/action" gibi bir şey deneyebilirsiniz? –