我正在尝试使用 SSH.NET 库访问 FTP 服务器,但没有任何运气。我正在提供与 FileZilla 中相同的凭据,这些凭据运行良好。SSH 抛出错误“套接字读取操作已超时”。如果我使用与下面相同的代码但没有指定端口:21,我会收到一个错误:“用户无法验证”。有人可以提供见解吗?
string tempHost = @"ftp.mywebsite.com";
string tempUser = @"ftp@mywebsite.com";
string tempPassword = @"try123";
using (SftpClient sftpClient =
new SftpClient((ConnectionInfo)new PasswordConnectionInfo(tempHost,21, tempUser, tempPassword)))
{
sftpClient.Connect();
}