2010-04-13 153 views
0

我想上傳一些文件大小35MB到blob容器上。 我已經編碼將數據拆分成塊並將其上傳到blob容器並使用PUT形成blob。Windows Azure:服務器錯誤,404 - 文件或目錄未找到

我測試了一些文件的代碼大小2MB什麼的......它運行良好。但是,當我嘗試了一個大MB的文件,它給我這個錯誤

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. 

當我嘗試它的大小文件6MB,它給了我這個錯誤..

Server Error in '/' Application. 
Runtime Error 
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine. 

Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off". 

<!-- Web.Config Configuration File --> 

<configuration> 
    <system.web> 
     <customErrors mode="Off"/> 
    </system.web> 
</configuration> 


Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL. 

<!-- Web.Config Configuration File --> 

<configuration> 
    <system.web> 
     <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/> 
    </system.web> 
</configuration> 

能有誰告訴我,如何解決這個問題...


上傳blob的代碼。

protected void ButUploadBlocks_click(object sender, EventArgs e) 
     { 

      // store upladed file as a blob storage 
      if (uplFileUpload.HasFile) 
      { 
       name = uplFileUpload.FileName; 
       byte[] byteArray = uplFileUpload.FileBytes; 
       Int64 contentLength = byteArray.Length; 
       int numBytesPerBlock = 250 *1024; // 250KB per block 
       int blocksCount = (int)Math.Ceiling((double)contentLength/numBytesPerBlock); // number of blocks 
       MemoryStream ms ; 
       int length = 0; 
       List<string>BlockIds = new List<string>(); 
       string block; 
       int offset = 0; 

       // get refernce to the cloud blob container 
       CloudBlobContainer blobContainer = cloudBlobClient.GetContainerReference("documents"); 

       if (textbox.Text != "") 
       { 
        name = textbox.Text + "/" + name; 

       } 
       // set the name for the uploading files 
       string UploadDocName = name; 

       // get the blob reference and set the metadata properties 
       CloudBlockBlob blob = blobContainer.GetBlockBlobReference(UploadDocName); 
       blob.Properties.ContentType = uplFileUpload.PostedFile.ContentType; 

       for (int i = 0; i < blocksCount; i++, offset = offset + numBytesPerBlock) 
       { 
        block = Convert.ToBase64String(BitConverter.GetBytes(i)); 
        ms = new MemoryStream(); 
        if (i == (blocksCount - 1)) 
        { 
         length = (int)contentLength - offset; 
        } 
        else 
        { 
         length = numBytesPerBlock; 
        } 
        ms.Write(byteArray, offset, length); 
        ms.Position = 0; 

        blob.PutBlock(block, ms, null); 
        BlockIds.Add(block); 
       } 

       blob.PutBlockList(BlockIds); 

       blob.Metadata["FILETYPE"] = "text"; 
      } 
     } 
+1

您是從ASP.NET服務器應用程序(服務器到雲)還是從桌面客戶端應用程序(桌面到雲)上傳到blob? 你是如何上傳到blob?顯示一些代碼。 – dthorpe 2010-04-15 16:58:05

回答

1

我的猜測是你正在達到ASP.NET的限制......有一個最大請求大小以及一個最大請求超時。我會在web.config中建議更改並查看異常情況。

相關問題