WinSCP.SessionLocalException: WinSCP process terminated with

Advertisement

cpvl
Joined:
Posts:
5

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);
}

Reply with quote

Advertisement

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

Reply with quote

cpvl
Joined:
Posts:
5

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

Reply with quote

cpvl
Joined:
Posts:
5

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)

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum