Topic "When uploading large files Say 200-300 MB using ,net Library it fails with error code 4"

Author Message
coolshashi
[View user's profile]

Joined: 2015-09-22
Posts: 7
Location: San Jose, CA
I get an exception and transfer of file fails when using WinSCP .net version 5.7.5

I am using SynchronizeDirectories method.

It has no issue uploading smaller files.


I get errors sometime with FileZilla too but it seems to (Error: error while writing: failure") to correct itself and succeed uploading the file.

Please help.

Shashi
Advertisements
coolshashi
[View user's profile]

Joined: 2015-09-22
Posts: 7
Location: San Jose, CA
The error message I get is

Upload of \\ProjectFiles\2015.09.01_5509\C6KA.zip failed: WinSCP.SessionRemoteException: Cannot close remote file 'C6KA.zip'. ---> WinSCP.SessionRemoteException: General failure (server should provide error description).
Error code: 4
Error message from server: Failure
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24994
Location: Prague, Czechia
Well, it's obviously a server-side problem. So please contact a server administrator first.
coolshashi
[View user's profile]

Joined: 2015-09-22
Posts: 7
Location: San Jose, CA
Thanks a lot for the reply. But I never get any issue with FileZilla finishing the job. Even if I see some errors it seems to finish.

I copy using FileZilla. Not synchronize.

For a new directory is it better to try copying instead of snychronize ?

Is there any difference using the WinSCP.exe with command line to .net library ?

Are there any additional flags that only availabele in command prompt that can help me ?

Shashi
coolshashi
[View user's profile]

Joined: 2015-09-22
Posts: 7
Location: San Jose, CA
I also see a .filepart file on the remote server when the error happens. Does this mean it has issues renaming that .filepart file to what ever the real extension ?
coolshashi
[View user's profile]

Joined: 2015-09-22
Posts: 7
Location: San Jose, CA
I am pasting my code here for you to look at so that you can tell me if there is anything i am missing.

remoteSession_FileTransferred errros out consistently on a large file. Once it has errored out on a file it seems to keep doing that when i re try too.

The file it gives me trouble is around 198MB and it fails around 187MB. I see a 187MB file that has .filepart extension of remote site.

Code:

private void SyncFolders(string srcPath, string dstPath, bool bCreateDestFolder = false)
        {
            if (Directory.Exists(srcPath))
            {
                if (bCreateDestFolder)
                {
                    if (!remoteSession.FileExists(dstPath))
                    {
                        remoteSession.CreateDirectory(dstPath);
                    }
                }
                remoteSession.SynchronizeDirectories(SynchronizationMode.Remote, srcPath, dstPath, true);
            }
        }
        private void ReleaseSoftwareToLfoundary()
        {
            UpdateStatus("Updating LFoundry FTP Site ..Please wait");
            WinSCP.SessionOptions sessionOpts = new SessionOptions();
            sessionOpts.HostName = "sftp.lfoundry.com";
            sessionOpts.PortNumber = 7788;
            sessionOpts.UserName = "username";
            sessionOpts.Password = "password";
            sessionOpts.Protocol = Protocol.Sftp;
            sessionOpts.GiveUpSecurityAndAcceptAnySshHostKey = true;
            sessionOpts.TimeoutInMilliseconds = 500000;
           

            bFTPFileTransferError = false;

            remoteSession = new Session();
            remoteSession.FileTransferred += new FileTransferredEventHandler(remoteSession_FileTransferred);
            remoteSession.Open(sessionOpts);

           
            int nCount = 0;
            while (remoteSession.Opened == false)
            {
                Thread.Sleep(200);
                nCount++;
                if (nCount == 25)//wait for 5 secs
                {
                    itemsFailed++;
                    AppendToLog("Connecting FTP server Failed");
                    return;
                }
            }
            try
            {
               
                srcPath = PublishFolder + @"ProjectFiles\" + VersionNumber;
                dstPath = @"ProjectFiles/" + VersionNumber;
                SyncFolders(srcPath, dstPath, true);

            }
            catch(Exception _ex)
            {

            };
     
        }
        private void remoteSession_FileTransferred(object sender, TransferEventArgs e)
        {
            if (e.Error != null)
            {
                bFTPFileTransferError = true;
                string message = string.Format("Upload of {0} failed: {1}", e.FileName, e.Error);
                AppendToLog(message);
            }
            else
            {
                string message = string.Format("Trasfered file {0} To FTP Site", e.FileName);
                AppendToLog(message);
            }
        }
coolshashi
[View user's profile]

Joined: 2015-09-22
Posts: 7
Location: San Jose, CA
I also tried switching off TransferResumeSupport, but Still I get teh same issue.

With

Code:


transferOptions = new TransferOptions();
transferOptions.ResumeSupport.State = TransferResumeSupportState.Off;

remoteSession.SynchronizeDirectories(SynchronizationMode.Remote, srcPath, dstPath, true,false, SynchronizationCriteria.Time, transferOptions);

[/code]
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24994
Location: Prague, Czechia
coolshashi wrote:
Thanks a lot for the reply. But I never get any issue with FileZilla finishing the job. Even if I see some errors it seems to finish.

You wrote that FileZilla has the problem too. The difference might be that FileZilla just displays the error and continues.

Quote:
I also see a .filepart file on the remote server when the error happens. Does this mean it has issues renaming that .filepart file to what ever the real extension ?

No. The error occurs when the uploaded file (the .filepart) closes. So WiSCP won't even try to rename the file.
coolshashi
[View user's profile]

Joined: 2015-09-22
Posts: 7
Location: San Jose, CA
The issue was with the space on the FTP site. Had trouble catching hold of FTP site owners to verify and create more space.

Thanks a lot.
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License