0

我想在 C# 中连接到 Ftp。

 public static byte[] DownloadFile(int timeout, string ftpServer, string filePath, string username, string password)
    {
     var client = new FtpClient();
        client.Connect(timeout, ftpServer, 21);
        client.Login(timeout, username, password);

        List<FtpItem> ftpItems = client.GetDirectoryList(timeout, directoryPath).ToList();
        return ftpItems;
    }

成功登录,但当我想获取文件时

        List<FtpItem> ftpItems = client.GetDirectoryList(timeout, directoryPath).ToList();

我收到此错误:Operation failed.

这个回应:425 Failed to establish connection.

4

0 回答 0