Post a reply

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)


Topic review


Please set Session.DebugLogPath and Session.SessionLogPath and post or email me both logs.

So after i restarted the server the exception went away and now i have a

Error: System.TimeoutException: Timeout waiting for WinSCP to respond.
at WinSCP.Session.CheckForTimeout()
at WinSCP.Session.Open(SessionOptions sessionOptions)

I've also used the Session.ExecutablePath property to force the assembly to look for the winscp.exe in a different location as the documentation suggested and still have the same error.

session.ExecutablePath = ConfigurationManager.AppSettings["WinSCPExePath"] + "WinSCP.exe";

They're located in the BIN folder of the .NET project which were copied from the Program Files folder after installing WinSCP and downloading .NET Assembly

Re: WinSCP.SessionLocalException: WinSCP process terminated with

WinSCP never returns exit code 3. So it could be system-level exist code, indicating WinSCP was never started:

Where are your winscp.dll and winscp.exe located?

WinSCP.SessionLocalException: WinSCP process terminated with

So im using the .NET assembly and i've tested this using Visual Studio debugger and then when I test it through the web server I get this error.

WinSCP.SessionLocalException: WinSCP process terminated with exit code 3 and output "", without creating a log file.
at WinSCP.Session.Open(SessionOptions sessionOptions)
at BuildSystem.Members.BuildLog.EditBuild.ScpPut(String fileUpload) in E:\BuildSystem\WebClientVersion2\Members\BuildLog\EditBuild.aspx.cs:line 59

I've pretty much used the code from the .NET Assembly example

SessionOptions sessionOptions = new SessionOptions
Protocol = Protocol.Scp,
HostName = ConfigurationManager.AppSettings["RemoteHost"],
UserName = ConfigurationManager.AppSettings["FileServerUsername"],
Password = ConfigurationManager.AppSettings["FileServerPassword"],
SshPrivateKey = "C:\\privatekey.ppk",
SshHostKey = "ssh-rsa 2048 xxxxxxxxxxxxxxxxxxxx",

using (Session session = new Session())
// Upload files
TransferOptions transferOptions = new TransferOptions();
transferOptions.TransferMode = TransferMode.Binary;

TransferOperationResult transferResult;
transferResult = session.PutFiles(@fileUpload, ConfigurationManager.AppSettings["FileServerUploadDir"], false, transferOptions);

// Throw on any error

// Print results
foreach (TransferEventArgs transfer in transferResult.Transfers)
Console.WriteLine("Upload of {0} succeeded", transfer.FileName);