WinSCP returns exit code 1 when no apparent errors

Advertisement

stevyrino
Guest

WinSCP returns exit code 1 when no apparent errors

Hello .... am using Server 2003 R2 with WinSCP 4.3.6 and .Net Automation in C#.
Am getting ExitCode = 1 on successful transer. No apparent errors in output or log.
These are attached.

relevant .net code:

winscp = new System.Diagnostics.Process();
winscp.StartInfo.FileName = "winscp.com";
winscp.StartInfo.Arguments = "/log=\"" + logname + "\"";
winscp.StartInfo.UseShellExecute = false;
winscp.StartInfo.RedirectStandardInput = true;
winscp.StartInfo.RedirectStandardOutput = true;
winscp.StartInfo.CreateNoWindow = true;
winscp.Start();

winscp.StandardInput.WriteLine("option batch abort");
winscp.StandardInput.WriteLine("option confirm off");
winscp.StandardInput.WriteLine("open sftp://IBD:xxxxxx@ftp.bcliquor.com:22 -hostkey=\"ssh-dss 2048 82:a3:23:ef:81:7f:6e:f9:d9:95:10:f9:a7:d4:b1:ef\"");
winscp.StandardInput.WriteLine("cd Incoming");
winscp.StandardInput.WriteLine("put " + "\"" + batchFilePath + "\"");
winscp.StandardInput.Close();

// Collect all output
string output = winscp.StandardOutput.ReadToEnd();

// Wait until WinSCP finishes
winscp.WaitForExit();
int winscpExitCode = winscp.ExitCode;
winscp.Close();

Any help would be greatly appreciated.

regards
srdux@yahoo.com
Description: /log= result
Description: result from winscp.StandardOutput.ReadToEnd()

Reply with quote

Advertisement

andys
Joined:
Posts:
3

I have the same issue

I have the same issue where my .NET code works fine and files are copied fine with no errors being logged but .NET is returning an exit code of 1

The stack trace is showing

MainModule = 'winscp.MainModule' threw an exception of type 'System.ComponentModel.Win32Exception'
base {System.Runtime.InteropServices.ExternalException} = {"Access is denied"}

I cannot see where the 'Access Denied' is being generated from as I am using accounts with full privileges on both source and destination systems

The winscp log shows a status code of 0

2012-02-08 10:45:59.414 Status code: 0
. 2012-02-08 10:45:59.414 Closing connection.
. 2012-02-08 10:45:59.414 Sending special code: 12
. 2012-02-08 10:45:59.414 Sent EOF message

Any help appreciated

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
40,430
Location:
Prague, Czechia

Re: WinSCP returns exit code 1 when no apparent errors

stevyrino wrote:

Hello .... am using Server 2003 R2 with WinSCP 4.3.6 and .Net Automation in C#.
Am getting ExitCode = 1 on successful transer. No apparent errors in output or log.
These are attached.
I have sent you an email.

Reply with quote

Advertisement

harsha
Guest

WINSCP not moving files into FTP

Hi,

WinScp is not moving files into ftp and I am getting below error.
MainModule 'winscp.MainModule' threw an exception of type 'System.ComponentModel.Win32Exception' System.Diagnostics.ProcessModule {System.ComponentModel.Win32Exception}

Please help.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
40,430
Location:
Prague, Czechia

Re: WINSCP not moving files into FTP

harsha wrote:

WinScp is not moving files into ftp and I am getting below error.
MainModule 'winscp.MainModule' threw an exception of type 'System.ComponentModel.Win32Exception' System.Diagnostics.ProcessModule {System.ComponentModel.Win32Exception}
We do not know what your winscp.MainModule is. You should also start your own thread. I do not see any relation to this one.

Reply with quote

Advertisement

You can post new topics in this forum