加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

ASP.NET MVC中的asp.net-mvc – 文件大小上传限制:web.config中

发布时间:2020-12-16 00:27:23 所属栏目:asp.Net 来源:网络整理
导读:我想为maxRequestLength设置多于1个设置 – 文件大小上传限制(例如一个用于File / New,另一个用于Picture / New)。我的所有操作都采取额外的参数(例如/ File / New?folderId = 234)。 单一设置按预期工作: httpRuntime executionTimeout="60" maxRequestL
我想为maxRequestLength设置多于1个设置 – 文件大小上传限制(例如一个用于File / New,另一个用于Picture / New)。我的所有操作都采取额外的参数(例如/ File / New?folderId = 234)。

单一设置按预期工作:

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

我试图在根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>

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

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

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

解决方法

看到我的回答: ASP.NET MVC and httpRuntime executionTimeout

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读