2009-10-27 44 views
0

我有一個網站,它允許安全(ssl)文件上傳和下載。該站點在帶有IIS 6.0的Window 2003服務器上運行; asp.net 2.文件下載失敗的文件超過64MB

當使用此代碼:

protected void StartDownLoad(string filename) 
    { 
     Response.Clear(); 
     if(filename.EndsWith("zip")) 
      Response.ContentType = "application/zip"; 
     else 
      Response.ContentType = "application/msword"; 

     string path = "C:\\Inetpub\\sites\\testsite\\secureDocs\\" + filename; 
     Response.WriteFile(path); 
     string headDesc = "inline;filename=" + filename; 

     Response.AddHeader("Content-Disposition", headDesc); 
     Response.End(); 
    }

在我的測試中沒有任何問題一個62MB文件下載 - 一個65MB似乎開始下載,然後立即停止。 http錯誤日誌有四個條目,每個條目顯示「Connection_Dropped」。如果我從文件夾中刪除權限並通過https url直接訪問文件,我可以下載超過65MB的文件,因此它看起來不像是IIS問題。有沒有限制響應寫入的asp.net設置?它是一個IIS問題?有沒有人遇到過這個?任何解決方案

回答

2

您可以嘗試使用的

Response.TransmitFile(path) 

代替

Response.WriteFile(path) 

TransmitFile()不緩衝的文件。

再見。

+0

非常感謝。 –