我正在将此库与C#一起使用,以将文件连接并上传到服务器: https://www.nuget.org/packages/CoreFtp/
我能够连接到FTP站点,但是使用SFTP进行的尝试会以连接超时作为响应。
每个人都有使用SFTP建立连接时该怎么做的示例吗?
这是我正在做的事的一个例子:
using (var ftpClient = new FtpClient(new FtpClientConfiguration
{
Host = FTPUrl,
Username = FTPUser,
Password = FTPPassword,
Port = FTPPort, // using port 21 for ftp, and port 22 for sftp
EncryptionType = FtpEncryption.Implicit,
IgnoreCertificateErrors = true
}))
{
await ftpClient.LoginAsync();
// do something with ftp client
}