Topic "WinSCP returns exit code 1 when no apparent errors"

Author Message
stevyrino

Guest


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
sftp20120202.log (6.41 KB) [Download]

Description: /log= result

output20120202.txt (744 Bytes) [Download]

Description: result from winscp.StandardOutput.ReadToEnd()

Advertisements
andys
[View user's profile]

Joined: 2012-02-08
Posts: 3
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
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
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.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
This bug has been added to the tracker:
http://winscp.net/tracker/show_bug.cgi?id=794
_________________
Martin Prikryl
Popillard

Guest


http://winscp.net/tracker/show_bug.cgi?id=794#c4
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
It will be released in few days.
harsha

Guest


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.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
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.
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