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

martin

dvd.ribeiro wrote:

Found out how to track session details:

Did it help you to resolve the problem?
dvd.ribeiro

Found out how to track session details:

using (Session session = new Session())

                        {
                            session.SessionLogPath = "Your full file Path here";
                            session.Open(sessionOptions);
                        }
dvd.ribeiro

Open session and log connection details

Hi all, I'm trying to troubleshoot a session opening which gives me the following error:

"Message: Terminated by user.

at WinSCP.SessionLogReader.Read(LogReadFlags flags)
at WinSCP.SessionElementLogReader.Read(LogReadFlags flags)
at WinSCP.CustomLogReader.WaitForNonEmptyElementAndCreateLogReader(String localName, LogReadFlags flags)
at WinSCP.Session.Open(SessionOptions sessionOptions)"

The code I'm running is the following:

SessionOptions sessionOptions = new SessionOptions();

                    sessionOptions.Protocol = Protocol.Sftp;
                    sessionOptions.HostName = "sftp.stuff.com";
                    sessionOptions.UserName = "username";
                    sessionOptions.Password = "password";
                    sessionOptions.GiveUpSecurityAndAcceptAnySshHostKey = true;

                    using (Session session = new Session())
                    {
                        session.Open(sessionOptions);
                       
                        TransferOptions transferOptions = new TransferOptions();
                        transferOptions.TransferMode = TransferMode.Binary;
                        transferOptions.PreserveTimestamp = false;

                        TransferOperationResult transferResult;
                        transferResult = session.PutFiles("C:\localfile.txt", "sftp.stuff.com/remotepath/remotefile.txt", false, transferOptions);

                        transferResult.Check();
                    }



Am I missing something here?

I believe that enclosing all code inside using it closes and disposes the connection.

After this error I was able to upload files to server correctly. is there any way to enable and use WinScp logging to trace connection issues?

Thank you.