Hi,
I am trying to use this library to upload a file via SFTP, and it connects fine and even puts an empty file onto the SFTP server, but then it just sits there and eventually times out with a session operation has timed out exception. The code is basically as follows:
I am trying to use this library to upload a file via SFTP, and it connects fine and even puts an empty file onto the SFTP server, but then it just sits there and eventually times out with a session operation has timed out exception. The code is basically as follows:
var uri = new Uri(remoteUri);
if (uri.Scheme == "sftp") {
// Upload the file using sftp over SSH
var host = uri.Host;
var userInfo = uri.UserInfo.Split(':');
if (userInfo.Length > 1) {
var username = userInfo[0];
var password = userInfo[1];
using (var sftp = new SftpClient(host, username, password)) {
sftp.Connect();
using (var file = File.OpenRead(localFile)) {
sftp.UploadFile(file, uri.LocalPath);
}
sftp.Disconnect();
}
} else {
throw new ArgumentException("Unable to parse username and password from URI");
}
}
Any idea what would cause this? I have debugged into a debug build of the source code (built with VS2012) and it gets stuck as soon as it attempts to send any data?






