我用HtmlInputFile做了一个上传文件的页面,上传小文件都没有问题,但是文件一超过4M上传就出错。在CSDN上听说可以配置web.config中的runmaxLength,默认值为4096,即4M。但不知道具体怎样配,请指教!帮助也没查到呀!!谢谢!

解决方案 »

  1.   

    试试看<system.web> <httpRuntime executionTimeout="1000" maxRequestLength="409600" useFullyQualifiedRedirectUrl="false"/> </system.web>
      

  2.   

    By default, ASP.NET only permits files that are 4,096 kilobytes (KB) (or 4 MB) or less to be uploaded to the Web server. To upload larger files, you must change the maxRequestLength parameter of the <httpRuntime> section in the Web.config file.If you want to change this setting for all of the computer and not just this ASP.NET application, you must modify the Machine.config file.By default, the <httpRuntime> element is set to the following parameters in the Machine.config file: 
    <httpRuntime 
    executionTimeout="90" 
    maxRequestLength="4096"
    useFullyQualifiedRedirectUrl="false" 
    minFreeThreads="8" 
    minLocalRequestFreeThreads="4"
    appRequestQueueLimit="100"
    /> 
    The Machine.config file is located in the C:\WINNT\Microsoft.NET\Framework\v1.0.3705\CONFIG directory.
    你可以在Machine.config 中以本机所有的上传做一个限制。也可以如楼上所说对某一个就用程序中用web.config对程序进行限制。