Topic "Connecting in Client Works, .Net Doesn't"

Author Message
rchamberlin
[View user's profile]

Joined: 2013-02-26
Posts: 3
Location: United States
Hello,

I am able to make an SFTP connection using public/private keys to our server using the WinSCP client. However, trying to connect via the .Net assembly doesn't work and errors with:

Connection has been unexpectedly closed. Server sent command exit status 0

Here are my SessionOptions:

SessionOptions sessionOptions = new SessionOptions
{
Protocol = Protocol.Sftp,
PortNumber = 22,
HostName = "servername",
UserName = "sftpuser",
SshHostKeyFingerprint = "ssh-rsa 1024 fc:e3:82:20:f1:6a:f2:a7:ef:ee:62:9a:48:e8:34:a7",
SshPrivateKeyPath = @"C:\temp\rsa-key-20130424_dvmsp006.ppk"
};

I couldn't find any documentation on whether I'm setting up my options correctly when doing this. Any help would be GREATLY appreciated!
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
Turn on session logging both in GUI and .NET (Session.SessionLogPath) and look for differences. If it does not help, please attach both logs here.
_________________
Martin Prikryl
d4_david
[View user's profile]

Joined: 2013-06-25
Posts: 4
Location: Prague
rchamberlin wrote:
Hello,

I am able to make an SFTP connection using public/private keys to our server using the WinSCP client. However, trying to connect via the .Net assembly doesn't work and errors with:

Connection has been unexpectedly closed. Server sent command exit status 0

Here are my SessionOptions:

SessionOptions sessionOptions = new SessionOptions
{
Protocol = Protocol.Sftp,
PortNumber = 22,
HostName = "servername",
UserName = "sftpuser",
SshHostKeyFingerprint = "ssh-rsa 1024 fc:e3:82:20:f1:6a:f2:a7:ef:ee:62:9a:48:e8:34:a7",
SshPrivateKeyPath = @"C:\temp\rsa-key-20130424_dvmsp006.ppk"
};

I couldn't find any documentation on whether I'm setting up my options correctly when doing this. Any help would be GREATLY appreciated!


Hi rchamberlin,
I do have same problem like you. Did you solve it somehow?
Thanks a lot.
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