【发布时间】:2018-09-13 20:11:42
【问题描述】:
我正在尝试使用 FluentFTP 通过端口 990 (TLS) 的 FTPS 连接下载文件。
但代码无法建立连接并显示异常为“根据验证程序,远程证书无效。”
当我手动使用 FileZilla FTP 工具时,FTP 服务器连接正常(显示为通过 ftps over TLS 连接(隐式)
FtpClient fclient = new FtpClient(hostname, username, password);
fclient.EncryptionMode = FtpEncryptionMode.Implicit;
fclient.SslProtocols = SslProtocols.Tls12; //Also tried with TLS1 and TLS
fclient.Port = 990;
fclient.Connect();
【问题讨论】:
-
您可能手动让 Filezilla 接受证书。如果您尝试连接新的 FTP 客户端,例如 WinSCP,会怎样?它会在没有任何关于证书的提示的情况下连接吗?
-
stackoverflow.com/questions/19327840/… 如问题所示,您可能会破解
ServerCertificateValidationCallback。如果您检查他们的文档/源代码,FluentFTP 可能有自己的证书验证处理程序。