Connecting in Client Works, .Net Doesn't

Advertisement

rchamberlin
Joined:
Posts:
3
Location:
United States

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!

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,226
Location:
Prague, Czechia

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.
_________________
Martin Prikryl

Reply with quote

d4_david
Joined:
Posts:
4
Location:
Prague

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.

Reply with quote

Advertisement

You can post new topics in this forum