如何解決IIS7上傳檔案大小限制 __IIS

來源:互聯網
上載者:User
IIS7 預設檔案上傳大小是30M,那麼超過30M的檔案就無法上傳了,那麼就需要對IIS的設定檔進行修改。

在實際應用中往往會出現上傳檔案太大,無法上傳的情況,那是因為IIS對上傳檔案大小有限制,IIS7 預設檔案上傳大小是30M,要突破這個限制需要做一下修改:

1.開啟 %windir%\system32\inetsrv\config\applicationhost.config 找到: <requestFiltering>節點

這個節點預設沒有 <requestLimits maxAllowedContentLength="上傳大小的值(單位:byte)" /> 元素,IIS 7和IIS 7.5上測試過 最大值只能是<requestLimits maxAllowedContentLength="4294967295" /> <4GB,

為這個節點新增如下案例元素:<requestLimits maxAllowedContentLength="2147483647" /> ,上傳的大小將改為2G

注意:%windir%\system32\inetsrv\config\applicationhost.config 檔案一定不要用其他機器的檔案替換,否則IIS將無法啟動 此檔案記錄了,當前IIS中所有Site , App pool的資訊,還有一些與機器相關的配置。

2.修改web.config

      <system.web>        <httpRuntime executionTimeout="36000" maxRequestLength="2097151"/>        <!--maxRequestLength:上傳的大小,單位K   ,executionTimeout:設定逾時時間,單位:秒。(預設是90秒) -->      </system.web>

3.web.config下如果有如下節點(此節點是為IIS 7設計的) ,則修改:  

 <requestLimits maxAllowedContentLength="2147483647" /> 單位與applicationhost.config中的<requestLimits maxAllowedContentLength="2147483647" />一致,它的最大值也只能為4294967295<system.webServer>        <security>          <requestFiltering>            <requestLimits maxAllowedContentLength="2147483647" />          </requestFiltering>        </security>      </system.webServer>

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.