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