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

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

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)
cpvl

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";
cpvl

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
martin

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:
http://www.hiteksoftware.com/knowledge/articles/049.htm

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

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())
{
session.Open(sessionOptions);
// 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
transferResult.Check();

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