zoukankan      html  css  js  c++  java
  • Net上传附件大小控控值(转)

    Server Error

    404 – File or directory not found.

    The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.

    用户上传一个大小大约为160MB的文件至服务器出现这个错误。Insus.NET把上传文件于本机测试没有问题。但上传至服务器时,这个错误产生了。

    本地可以,服务器却Error。可以肯定程序代码没有问题,怎样说呢?Insus.NET 测试尝试上传另一个相同的文件格式,只是大小有所改变,大小约为25MB,它即能成功上传了。

    Insus.NET检查了web.config文件,可以上传的文件限制已经设置相当大了200MB。

    <system.web>   
        <httpRuntime maxRequestLength="204800" useFullyQualifiedRedirectUrl="true" minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="100" enableVersionHeader="true" executionTimeout="6000" />
      </system.web>

    问题出于哪里?

    找到资料,原来IIS 的maxAllowedContent Length的缺省值为30000000 bytes.  上传大于这个长度的数据流被截断,导致文件或目录找不到。

    因此Insus.NET尝试在web.config更改这个设置,添加下面节点:

    复制代码
    <system.webServer>    
        <security>
          <requestFiltering>
            <requestLimits maxAllowedContentLength="2097152000" maxQueryString="5000" maxUrl="8000"></requestLimits>
          </requestFiltering>
        </security>
      </system.webServer>
    复制代码

     最后测试上传200MB的文件,能成功上传。

  • 相关阅读:
    67. Add Binary
    66. Plus One
    64. Minimum Path Sum
    63. Unique Paths II
    How to skip all the wizard pages and go directly to the installation process?
    Inno Setup打包之先卸载再安装
    How to change the header background color of a QTableView
    Openstack object list 一次最多有一万个 object
    Openstack 的 Log 在 /var/log/syslog 里 【Ubuntu】
    Git 分支
  • 原文地址:https://www.cnblogs.com/easypass/p/3641588.html
Copyright © 2011-2022 走看看