C# 콘솔 응용 프로그램에서 FTP를 사용하여 파일을 다운로드하려고합니다. 그러나 이제는 경로가 올바르지 만 "550 파일을 찾을 수 없음"이라는 오류 메시지가 항상 나타납니다.C# 단일 파일 FTP 다운로드
서버에 연결된 현재 경로를 반환하는 방법이 있습니까?
// lade datei von FTP server
string ftpfullpath = "ftp://" + Properties.Settings.Default.FTP_Server + Properties.Settings.Default.FTP_Pfad + "/" + Properties.Settings.Default.FTP_Dateiname;
Console.WriteLine("Starte Download von: " + ftpfullpath);
using (WebClient request = new WebClient())
{
request.Credentials = new NetworkCredential(Properties.Settings.Default.FTP_User, Properties.Settings.Default.FTP_Passwort);
byte[] fileData = request.DownloadData(ftpfullpath);
using (FileStream file = File.Create(@path + "/tmp/" + Properties.Settings.Default.FTP_Dateiname))
{
file.Write(fileData, 0, fileData.Length);
file.Close();
}
Console.WriteLine("Download abgeschlossen!");
}
편집 내 실수. 여전히 동일한 오류가 발생하는 파일 경로가 수정되었습니다. 하지만 정확한 파일 경로 인 FileZilla에 연결하면됩니다.
수정 됨. 위 참조. 여전히 같은 오류. 실수를 지적 해 주셔서 감사합니다. 몇 시간 씩 시도해 보았습니다. 웹에서 찾은 여러 가지 해결책이 있지만 항상 같은 결과를 얻었습니다. –
FTP_Server 이후 /가 누락되지 않았다고 가정합니다. (나는 FTP_Pfad가 디렉토리라고 가정하고있다.) – Tim
또 다른 가능성은 당신이 다른 사용자/패스워드를 사용하고 있고 ftp 서버에 다른 루트 디렉토리를 얻고 있다는 것이다. – Tim