FtpWebRequest - Error large files

1

I have a desktop application made in C # running a few months on a client. The same requested a module to perform uploads and downloads on an FTP server, the database is currently in the clouds by KingHost, as this company already offers the service, I chose to continue in it, but I have some problems ...

My algorithm has no problem uploading to small files, but files with more than 20MB are experiencing the following error: "The underlying connection was closed: Unexpected error on a receive"

I contacted the hosting company and was informed that no problem was found.

DETAIL: After a few minutes of the error, when verifying ftp the file is there ...

Follow algorithm:

                    FtpWebRequest request = (FtpWebRequest)FtpWebRequest.Create(cboServidor.Text + cboGrupoArquivo.Text + "/" + Path.GetFileName(openFileDialog1.FileName));
                    request.Method = WebRequestMethods.Ftp.UploadFile;
                    request.Credentials = new NetworkCredential(txtUsuario.Text, txtSenha.Text);
                    request.UsePassive = true;
                    request.UseBinary = true;
                    request.KeepAlive = false;


                    FileStream stream = File.OpenRead(openFileDialog1.FileName);
                    byte[] buffer = new byte[stream.Length];

                    stream.Read(buffer, 0, buffer.Length);
                    stream.Close();

                    Stream reqStream = request.GetRequestStream();
                    reqStream.Write(buffer, 0, buffer.Length);
                    reqStream.Close();
    
asked by anonymous 02.01.2017 / 23:17

0 answers