ASP.NET MVC中的asp.net-mvc – 文件大小上传限制:web.config中的超过1个maxRequestLength设置

前端之家收集整理的这篇文章主要介绍了ASP.NET MVC中的asp.net-mvc – 文件大小上传限制:web.config中的超过1个maxRequestLength设置前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我想为maxRequestLength设置多于1个设置 – 文件大小上传限制(例如一个用于File / New,另一个用于Picture / New)。我的所有操作都采取额外的参数(例如/ File / New?folderId = 234)。

单一设置按预期工作:

<httpRuntime executionTimeout="60" maxRequestLength="1024" />@H_404_5@ 
 

我试图在根web.config中有2个位置部分的设置,但没有任何成功。我不知道在“路径” – 视图的物理aspx页面或控制器操作中写什么…但是,似乎没有任何效果

<location path="/File/">
    <system.web>
        <httpRuntime executionTimeout="60" maxRequestLength="4096" />
    </system.web>
</location>
<location path="/Picture/">
    <system.web>
        <httpRuntime executionTimeout="60" maxRequestLength="1024" />
    </system.web>
</location>@H_404_5@ 
 

我试图将另一个web.config放在一个特定的视图文件夹(例如/ Views / Picture / …)中,就像它在经典的Webform ASP.NET中工作一样,但这似乎也不是窍门…

<location path="">
    <system.web>
        <httpRuntime executionTimeout="60" maxRequestLength="1024" />
    </system.web>
</location>@H_404_5@ 
 

无论我做什么,只应用httpRuntime.maxRequestLength的一个值 – 在(root)web.config … system.web中。

解决方法

原文链接:https://www.f2er.com/aspnet/252314.html

猜你在找的asp.Net相关文章