zoukankan      html  css  js  c++  java
  • .Net上传文件大小配置

    1、起因

      今天同事在上传文件的时候,发现一直失败,说文件比较大。一听就明白了,肯定是上传文件大小的问题啊。然后查看web.config文件,发现设置过文件上传的大小限制。配置文件上传大小,分为2部分。

     <httpRuntime maxRequestLength="1073741824"   executionTimeout="3600" useFullyQualifiedRedirectUrl="true" requestValidationMode="2.0" />

    2、web.config级设置

      此处的maxRequestLength设置是.net级的设置,单位是KB

     <httpRuntime maxRequestLength="1073741824"   executionTimeout="3600" useFullyQualifiedRedirectUrl="true" requestValidationMode="2.0" />

    3、IIS服务器级设置

      这里有2种方式:

      1)iis管理器端设置,找到自己的网站。前提是在安装iis的时候,有安装请求筛选,如下图。然后选择请求筛选,编辑功能设置,把允许的最大内容长度更改为所需要的大小,注意这里单位是字节。这里确定后,iis会自动在web.config中添加一段代码。这也是下面要介绍的第2种方式。

      2)在web.config中的system.webServer中添加配置。注意,单位是字节。

        <security>
                <requestFiltering>
                    <requestLimits maxAllowedContentLength="8703144" />
                </requestFiltering>
            </security>

    参考文档:

      https://stackoverflow.com/questions/6327452/which-gets-priority-maxrequestlength-or-maxallowedcontentlength

      https://forums.asp.net/t/1965933.aspx?increase+upload+limit+system+webServer+security+requestFiltering+requestLimits+maxAllowedContentLength+10485760+requestFiltering+security+system+webServer+

      

  • 相关阅读:
    Codeforces Round #702 (Div. 3) 题解
    Educational Codeforces Round 104 (Rated for Div. 2) A~E题解
    AtCoder Regular Contest 112 A~D题解
    Codeforces Round #701 (Div. 2) A~E 题解
    java String, StringBuffer, StringBuilder简单介绍和使用
    货仓选址
    线程的同步
    数据结构课设作业
    线程的生命周期(java 图)
    JAVA多线程的创建和使用
  • 原文地址:https://www.cnblogs.com/zhaoyihao/p/7085532.html
Copyright © 2011-2022 走看看