Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

coolshashi

Issue Fixed

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.
martin

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.

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

I also tried switching off TransferResumeSupport, but Still I get teh same issue.

With

transferOptions = new TransferOptions();

transferOptions.ResumeSupport.State = TransferResumeSupportState.Off;

remoteSession.SynchronizeDirectories(SynchronizationMode.Remote, srcPath, dstPath, true,false, SynchronizationCriteria.Time, transferOptions);
[/code]
coolshashi

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.

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

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

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
martin

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

Well, it's obviously a server-side problem. So please contact a server administrator first.
coolshashi

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
coolshashi

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

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