2012-09-27 16 views
5

Bazı dosyaları yüklemek istediğim bir Azure Blob Storage var. Bir 3.5Mo dosyası ile test
Azure blob depolama alanı yükleme hatası

public ActionResult File_post(HttpPostedFileBase file) 
{ 
    CloudBlobContainer blobContainer = Initialize(); // This Initialize my blobContainer 
    CloudBlockBlob blob; 
    blob = blobContainer.GetBlockBlobReference("myfile"); 
    blob.UploadFromStream(file.InputStream); 
    Return("Index"); 
} 



Index.cshtml

@using (Html.BeginForm("File_post", "MyController", FormMethod.Post, new { enctype = "multipart/form-data" })) 
{ 
    <div class="editor-label"> 
    <p> 
     <input type="file" name="file" /> 
    </p> 
     <input type="submit" value="Upload" /> 
    </div> 
} 

MyController.cs, hatta bir 20Mo dosyası ile çalışır. Şimdi bir 33Mo ile denemek ve firefox bana temel hata veriyor: Bağlantı sıfırlandı ...

Düzenleme:

public ActionResult File_post(HttpPostedFileBase file) 
{ 
    Return("Index"); 
} 

O bana aynı hata veriyor koymak, bu yüzden düşünüyorum C# kodumdan kaynaklanmadı.

Herhangi bir fikrin var mı? Çok teşekkürler !

cevap

7
Sen ASP.NET ve IIS büyük dosya yüklemeleri izin vermek için web.config değiştirmeniz gerekir

(Aşağıdaki örnek, bir 50MB dosya yüklemesini sağlayacak):

<?xml version="1.0" encoding="utf-8"?> 
<configuration> 
    <system.web> 
     <httpRuntime maxRequestLength="51200" /> 
    </system.web> 
    <system.webServer> 
     <security> 
      <requestFiltering> 
       <requestLimits maxAllowedContentLength="51200000" /> 
      </requestFiltering> 
     </security> 
    </system.webServer> 
</configuration> 
+0

+1. Ve gerçekten büyük dosyalar için varsayılan istek 2 dakika zaman aşımı bir sorun olabilir. –

İlgili konular