huiselele 发表于 2015-11-3 08:42:27

windows 2008 server iis7 服务上传文件大小限制

windows 2008 server iis7 服务上传文件大小限制
  一、修改iis7 上传大文件限制
  修改C:/Windows/System32/inetsrv/config/schema/IIS_schema.xml文件(修改该文件需要获得这个文件的控制权),找到maxAllowedContentLength, 其默认值为30000000,即30M,加一个0 就变成了 300MB 了就应该够用了,如果不起作用,则需要重启 IIS 7即可:
  <element name=&quot;requestLimits&quot;>
         <attribute name=&quot;maxAllowedContentLength&quot; type=&quot;uint&quot; defaultValue=&quot;30000000&quot; />
         <attribute name=&quot;maxUrl&quot; type=&quot;uint&quot; defaultValue=&quot;4096&quot; />
          <attribute name=&quot;maxQueryString&quot; type=&quot;uint&quot; defaultValue=&quot;2048&quot; />
          <element name=&quot;headerLimits&quot;>
          <collection addElement=&quot;add&quot; clearElement=&quot;clear&quot; removeElement=&quot;remove&quot; >
             <attribute name=&quot;header&quot; type=&quot;string&quot; required=&quot;true&quot; isUniqueKey=&quot;true&quot; validationType=&quot;nonEmptyString&quot; />
             <attribute name=&quot;sizeLimit&quot; type=&quot;uint&quot; required=&quot;true&quot; />
          </collection>
      </element>
  二、IIS7.0的修改方法如下:
打开IIS管理器–双击“IIS”中的“ASP”– 打开“配置 ASP 应该程序的属性”–展开“限制属性”;修改“最大请求实体主体限制”的值,默认值为200000(即不到200KB);把它修改为你想修改的大小
  
  或者在ASP.net的web.config添加:
  
  <system.web>   
  <!-- 设置可上传的最大文件大小 -->
  <httpRuntime maxRequestLength=&quot;1048576&quot; requestValidationMode=&quot;2.0&quot; />
  </system.web>
  
  参考:http://hi.baidu.com/skycell/item/04a47e32ddfc94f7e6bb7a07
页: [1]
查看完整版本: windows 2008 server iis7 服务上传文件大小限制