Impossible de télécharger un fichier SFTP à l'aide de SSH.NET en C # - Autorisation refusée

Je suis en train de télécharger un fichier en utilisant le protocole SFTP à l'aide de C# à l'aide de SSH.NET de la bibliothèque. Ci-dessous est le code, je suis en utilisant

FileInfo f=new FileInfo("C:\\mdu\\abcd.xml");            
string uploadfile=f.FullName;    
Console.WriteLine(f.Name);
Console.WriteLine("uploadfile"+uploadfile);
var client = new SftpClient(host, port, username, password);
client.Connect();
if(client.IsConnected){
       Console.WriteLine("I AM CONNECTED");
}
var fileStream = new FileStream(uploadfile, FileMode.Open);  
if(fileStream!=null){
            Console.WriteLine("YOU ARE NOT NULL");
}
client.BufferSize = 4 * 1024; 
client.UploadFile(fileStream, f.Name,null);
client.Disconnect();
client.Dispose();

Je suis en mesure de se connecter et la filestream est pas NULL. Mais je suis PermissionDeniedException tout en essayant de télécharger un fichier.

Unhandled Exception: Renci.SshNet.Common.SftpPermissionDeniedException: Permission denied
   at Renci.SshNet.Sftp.SftpSession.RequestOpen(String path, Flags flags, Boolean nullOnError)
   at Renci.SshNet.SftpClient.InternalUploadFile(Stream input, String path, Flags flags, SftpUploadAsyncResult asyncResult, Action`1 uploadCallback)
   at Renci.SshNet.SftpClient.UploadFile(Stream input, String path, Boolean canOverride, Action`1 uploadCallback)
   at Renci.SshNet.SftpClient.UploadFile(Stream input, String path, Action`1 uploadCallback)
   at movemsi.Program.UploadFile()
   at movemsi.Program.Main(String[] args)

Est-il de tous les paramètres, je suis absent à partir du code ci-dessus. Toute aide est très appréciée.

source d'informationauteur Timothy Rajan | 2015-10-01