Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

d4_david

Re: Connecting in Client Works, .Net Doesn't

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.
martin

Re: Connecting in Client Works, .Net Doesn't

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.
rchamberlin

Connecting in Client Works, .Net Doesn't

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!