Topic "WinSCP.SessionLocalException: WinSCP process terminated with"

Author Message
cpvl
[View user's profile]

Joined: 2012-06-13
Posts: 5
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);
}
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
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?
_________________
Martin Prikryl
cpvl
[View user's profile]

Joined: 2012-06-13
Posts: 5
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
cpvl
[View user's profile]

Joined: 2012-06-13
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";
cpvl
[View user's profile]

Joined: 2012-06-13
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)
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
Please set Session.DebugLogPath and Session.SessionLogPath and post or email me both logs.
_________________
Martin Prikryl
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License