Renci.SshNet.Common.SshConnectionException: An established connection was aborted by the server
See original GitHub issueI 'm using Rencii package and it used to work however when I do List Directory which has got more than 2000 files, that is where it’s breaking and giving established connection was aborted.
using System;
using System.Collections.Generic;
using System.IO;
using Renci.SshNet;
namespace worship_sync
{
class Program
{
static void Main(string[] args)
{
const string host = "******";
const string username = "****";
const string password = "vagrant";
const string workingdirectory = "*****";
const string uploadfile = #"******";
Console.WriteLine("Creating client and connecting");
using (SftpClient client = new SftpClient(host, 8822, username, password))
{
client.Connect();
Console.WriteLine("Connected to {0}", host);
client.ChangeDirectory(workingdirectory);
Console.WriteLine("Changed directory to {0}", workingdirectory);
var listDirectory = client.ListDirectory(workingdirectory); // ERROR
Console.WriteLine("Listing directory:");
foreach (var fi in listDirectory)
{
Console.WriteLine(" - " + fi.Name);
}
}
}
}
}
AND I got this error when I am runing my code: Unhandled Exception: Renci.SshNet.Common.SshConnectionException: An established connection was aborted by the server.
Issue Analytics
- State:
- Created 4 years ago
- Comments:15 (4 by maintainers)
Top Results From Across the Web
SSH.NET - An established connection was aborted by the ...
Today I've upgraded it to SLES12 SP1 and when I'm trying to connect with server (through application with SSH.NET) I get exception -...
Read more >an established connection was aborted by the server
Hi All, We are facing issue while running the unix command. Running as simple command as "ls" is returning "an established connection was...
Read more >An established connection was aborted by the server
Looking at this third-party open-source SSH library, the “aborted by the server” usually means a send or receive transferred zero bytes of data ......
Read more >How to fix an established connection was aborted by the ...
Hello Team, While we are trying to connect SFTP using SSH public key authentication we are getting following error. Established connection ...
Read more >Karaf server SSH connection not happing via ssh.net dll
Renci.SshNet.Common.SshConnectionException: An established connection was aborted by the server. However sshconnection to Karaf server-4.3.1 ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
To the people asking for updates, have you tried running your code in Visual Studio in Debug mode? You should see plenty SshNet.Logging debug messages in the Output pane (Show output from: Debug) if you have a debug build of the library attached to your solution. Please see here https://github.com/sshnet/SSH.NET/wiki/Troubleshooting-SSH.NET e.g.
Hi everyone, i just encountered the same problem in my case, there are a few code and the logs are as follows:
client error log:
Renci.SshNet.Common.SshConnectionException: An established connection was aborted by the server.\n at Renci.SshNet.Session.WaitOnHandle(WaitHandle waitHandle, TimeSpan timeout)\n at Renci.SshNet.Session.WaitOnHandle(WaitHandle waitHandle)\n at Renci.SshNet.Session.Connect()\n at Renci.SshNet.BaseClient.CreateAndConnectSession()\n at Renci.SshNet.BaseClient.Connect()server error log:
ERRORS KEX_FAILURE Message="no matching host key type found" Kex=ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-rsa,ssh-dss SourceIP=xxx.xxx.xxx.xxxBy the way, i used the same information connect success by openssh-client, but it can’t be correct result by my code which using Renci.SshNet. @drieseng Can you help me to check the Renci.SshNet’s ssh version different openssh-client