2012-07-18 2 views
0
While uploading Zip file more than 20MB into FTP server, the Error [The underlying connection was closed: An unexpected error occurred on a receive] raised in suituation. 
here i attached the code. for where the exception raise 
{ftpReq.Credentials = new NetworkCredential(userName, passWord); 
       ftpReq.KeepAlive = false; 
       ftpReq.Method = WebRequestMethods.Ftp.UploadFile; 
       ftpReq.UseBinary = true; 
       FileStream fs = fileInfo.Open(FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite); 
       byte[] buffer = new byte[fs.Length]; 
       fs.Read(buffer, 0, buffer.Length); 
       Stream ftpstream = ftpReq.GetRequestStream(); 
       ftpstream.Write(buffer, 0, buffer.Length); 
      **`ftpstream.Close();`****----> the Error Appeared in the suituation while closing FTP connection .i applied solution for the problem from website . 
    i have set Timeout Property of FTP. {ftpreq.Timeout=300000[5min] } above Web Request methods. In My Local Host it' allow to upload upto 50. while uploading file in Production it allows 30 MB file to upload. if we upload more than 30 MB shows error "Server time out problem"i have tried lot of testing, but i could not fix the issue. 

Veuillez fournir une solution correcte Pourquoi nous ne pouvons pas télécharger plus de taille de fichier. pour ce que nous devons faire?Erreur dans le téléchargement de fichier à partir du site Web vers le serveur FTP dans ASP.net MVC3.0

Répondre

0

Je pense que vous devez changer la taille de téléchargement par défaut dans votre webconfig

Vous aimez cette

<configuration> 
    <system.web> 
    <httpRuntime maxRequestLength="size in kbs" /> 
    </system.web> 
</configuration> 

La valeur par défaut est 4096 (= 4 Mo).

+0

HI j'ai déjà défini la valeur Anandharaj

Questions connexes