• 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的文件,能成功上传。

  • 相关阅读:
    source命令
    [电脑配置]屏幕扩展过,找不到界面
    [SAS]方便查询Tips
    [Excel]方便查询Tips
    [SAS]运用函数等的一些问题
    [SAS]错误整理
    [SAS]易错例子之数值型转字符型
    [R]Precedence
    [sas]Missing Value
    [SAS]
  • 原文地址:https://www.cnblogs.com/easypass/p/3641588.html
Copyright © 2020-2023  润新知