Repository navigation
Closed
Milestone
Description
Hi
I have a problem with SSH.Net 2020.0.0 When trying to SFTP file to Linux Server.
I am using .Net Core 3.1 under IIS.
The error that I am getting randomly is that the server is timing out.
Renci.SshNet.Common.SshOperationTimeoutException: Connection failed to establish within 30000 milliseconds.
Below is my code.
var connectionInfo = new RenciSftp.ConnectionInfo(this.FileServerHost,
this.FileServerUsername,
new RenciSftp.PasswordAuthenticationMethod(this.FileServerUsername, this.FileServerPassword));
using (var client = new RenciSftp.SftpClient(connectionInfo))
{
try
{
client.Connect();
client.ChangeDirectory(remoteDir);
client.BufferSize = 4 * 1024; // bypass Payload error large files
using (var fileStream = fileStorage.GetFileStream(session))
{
client.UploadFile(fileStream, serverFilename);
}
}
catch (Renci.SshNet.Common.SshConnectionException ex)
{
this.AddUploadError("ERROR","SshConnectionException", hostName + "; " + IP, ex.ToString());
}
catch (System.Net.Sockets.SocketException ex)
{
this.AddUploadError("ERROR", "SocketException", hostName + "; " + IP, ex.ToString());
}
catch (Renci.SshNet.Common.SshAuthenticationException ex)
{
this.AddUploadError("ERROR","SshAuthenticationException", hostName + "; " + IP, ex.ToString());
}
catch (Exception ex)
{
this.AddUploadError("ERROR","General Error", hostName + "; " + IP, ex.ToString());
}
client.Disconnect();
client.Dispose();
}
Reacted by Varun Venkatesh
Metadata
Metadata
Assignees
Labels
No labels
Activity
alona0610 commentedon Jan 27, 2021
Any info on that error?
vvvarunv commentedon Feb 25, 2021
With 2020.0.1 I am also seeing similar errors
connection time(ms) : 30013, exception : Renci.SshNet.Common.SshOperationTimeoutException: Session operation has timed out
I reverted to 2016.1.0 and things are fine now
This is when trying to SSH into a Cisco router.
vvvarunv commentedon Feb 25, 2021
@drieseng : Any update on this?
drieseng commentedon Feb 27, 2021
Can any of you give me (private) access to a server/device that I can use to reproduce this issue?
Sparin commentedon Jun 24, 2021
Hi everyone!
We (on my job) recently met this error on connecting to Cisco Catalyst 9300-48UN-A Switch (Cisco IOS XE 16.12.2s). In our case, we unexpectedly stuck at awaiting
SSH_MSG_KEXINITfrom the Cisco switch after a few successful connections. It's just awaiting 30 seconds for timeout and drop the connection then.During a sniffing session, we've concluded switch awaits
SSH_MSG_KEXINITfrom us for no reason. We tried to move sendingSSH_MSG_KEXINITfrom theKeyExchange.csfile/procedure just before the awaitingSSH_MSG_KEXINITfrom the server atSession.cs. Looking to RFC 4253 Section 7 and source code of SSH.NET, I didn't find any reason to awaitsSSH_MSG_KEXINITfrom the server. So it looks like a race condition deadlock.Our step to reproduce a little bit the same
Our code snippet which we are testing
@drieseng We don't have direct access to the switch and server with this problem, but maybe we can agree on a Zoom session with the owner. But probably they'll decline the request for NDA reasons
WojciechNagorski commentedon Dec 21, 2023
It's done in #1274
WojciechNagorski commentedon Dec 29, 2023
The 2023.0.1 version has been released to Nuget: https://www.nuget.org/packages/SSH.NET/2023.0.1