文件大小限制上传在ASP.NET MVC:在web.config中超过1 maxRequestLength设置(S) [英] file size upload limitation in ASP.NET MVC: more than 1 maxRequestLength setting in web.config(s)

查看:1585
本文介绍了文件大小限制上传在ASP.NET MVC:在web.config中超过1 maxRequestLength设置(S)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想有超过1设置了maxRequestLength - 文件大小限制上传(例如一个用于文件/新建,其余为图片/新建)。我所有的行动中采取额外的参数(例如/文件/新建?folderId = 234)。

I'd like to have more than 1 setting for maxRequestLength - file size upload limitation (e.g. one for File/New, other for Picture/New). All of my Actions take additional parameters (e.g. /File/New?folderId=234).

单设置按预期工作:

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

我想有2个设置在根web.config 2段位置,但没有成功。我不知道做什么,在路径写 - 物理aspx页面视图,或者控制器+动作......但似乎没有任何工作。

I tried to have 2 settings with 2 location sections in the root web.config, but without any success. I'm not sure what to write in "path" - physical aspx page of a view, or controller+action... however, nothing seems to work.

<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中的特定视图文件夹(例如/查看/图片/ ...),喜欢它的工作原理在传统的网络表单ASP.NET,但这似乎并不要么做的伎俩。 ..

I tried to put another web.config in a specific view folder (e.g. /Views/Picture/...), like it works in classic Webform ASP.NET, but this doesn't seem to do the trick either...

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

不管我做什么,为httpRuntime.maxRequestLength只有一个值被应用 - 在(根)web.config中...的System.Web

No matter what I do, only one value for httpRuntime.maxRequestLength is applied - that in (root) web.config...system.web.

推荐答案

在这里看到我的回答:<一href=\"http://stackoverflow.com/questions/492346/asp-net-mvc-and-httpruntime-executiontimeout/636609#636609\">ASP.NET MVC和的httpRuntime executionTimeout

See my answer here: ASP.NET MVC and httpRuntime executionTimeout

这篇关于文件大小限制上传在ASP.NET MVC:在web.config中超过1 maxRequestLength设置(S)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆