【发布时间】:2009-06-24 14:30:07
【问题描述】:
我想为 maxRequestLength 设置 1 个以上的设置 - 文件大小上传限制(例如,一个用于文件/新建,另一个用于图片/新建)。我的所有操作都采用额外的参数(例如 /File/New?folderId=234)。
单一设置按预期工作:
<httpRuntime executionTimeout="60" maxRequestLength="1024" />
我尝试在根 web.config 中有 2 个位置部分的 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>
我尝试将另一个 web.config 放在特定的视图文件夹中(例如 /Views/Picture/...),就像它在经典的 Webform ASP.NET 中一样,但这似乎也不起作用。 ..
<location path="">
<system.web>
<httpRuntime executionTimeout="60" maxRequestLength="1024" />
</system.web>
</location>
无论我做什么,只有一个 httpRuntime.maxRequestLength 值被应用 - 在(根)web.config...system.web 中。
【问题讨论】:
标签: asp.net-mvc file-upload web-config maxrequestlength