Topic "Cannot connect to SFTP server via .Net (Network error: Connection refused), but using GUI works"

Author Message
RyanWeir
[View user's profile]

Joined: 2015-06-19
Posts: 2
Hi,

There is a SFTP server I need to connect to, using username and password. I can connect to it using the GUI, but I cannot using the .Net assembly. I get a 'Network error: Connection refused'. Attached should be all the relevant information. The SFTP server is only using SFTP-3, so I even tried using SessionOptions.AddRawSettings("SFTPMaxVersion", "3");. The SFTP owners say they do see successes in their logs, but only when I use the GUI. The failures come up as using port 21. My logs do show that after SFTP fails, it knocks the FTP port. They don't state at what point it fails, and my logs do not show this either.

Any suggestions to fix this?

Thanks
CSharpCode.JPG (75.21 KB) Private file

Description: C# code

sessionLog.jpg (215.1 KB) Private file

Description: Session log

SFTPVersion.JPG (21.57 KB) Private file

Description: SFTP server version

Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
Please attach a full (unobfuscated) session log file showing the problem along with log of a working GUI session (using the latest version of WinSCP).

To generate log file, set Session.SessionLogPath. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.
RyanWeir
[View user's profile]

Joined: 2015-06-19
Posts: 2
Attached are the logs.
sessionlog_5.7.4_GUI.log (7.52 KB) Private file

Description: Session log for GUI

sessionlog_5.7.4.log (3.96 KB) Private file

Description: Session log for .NET assembly

martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
I'd say that the UserCustomServices account does not have an access to network allowed.

Try to run the code using the same account you use for GUI (Administrator).
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