Skip to content

When I wan't to upload a file then I get an exception | Channel was closed #617

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sm-a opened this issue Jan 24, 2020 · 1 comment
Closed

Comments

@sm-a
Copy link

sm-a commented Jan 24, 2020

When I wan't to UploadFile then I get the following exception:
Renci.SshNet.Common.SshException: Channel was closed.
at Renci.SshNet.SubsystemSession.WaitOnHandle(WaitHandle waitHandle, Int32 millisecondsTimeout)
at Renci.SshNet.Sftp.SftpSession.OnChannelOpen()
at Renci.SshNet.SubsystemSession.Connect()
at Renci.SshNet.SftpClient.CreateAndConnectToSftpSession()
at Renci.SshNet.SftpClient.OnConnected()
at Renci.SshNet.BaseClient.Connect()

How can I get rid of this?

Greetings,
Sven

Here my code:

ConnectionInfo conInfo = new ConnectionInfo(smaHost, 22, smaUserName, new AuthenticationMethod[]{
    new PasswordAuthenticationMethod(smaUserName,smaPW)
});

SftpClient sftpClient = new SftpClient(conInfo);
sftpClient.Connect();

string filePath = Path.Combine(ApplicationData.Current.LocalFolder.Path, "mongodb-org-4.2.repo")
sftpClient.UploadFile(SMAReader(filePath), "/etc/yum.repos.d/mongodb-org-4.2.repo", true);

sftpClient.Disconnect();
sftpClient.Dispose();
@sm-a
Copy link
Author

sm-a commented Jan 24, 2020

I have found the issue. The Server requested for a password change. After password change it works.

Greetings,
Sven

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant