我试图使用以下代码获取FTPS FileZilla服务器的目录列表:
ftpRequest = (FtpWebRequest)FtpWebRequest.Create(host + "/" + directory);
ftpRequest.EnableSsl = true;
ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(ValidateCertificate);
ftpRequest.Credentials = new NetworkCredential(user,pass);
ftpRequest.UseBinary = true;
ftpRequest.UsePassive = true;
ftpRequest.KeepAlive = true;
ftpRequest.Method = WebRequestMethods.Ftp.ListDirectory;
ftpResponse = (FtpWebResponse)ftpRequest.GetResponse();
执行FtpWebResponse)ftpRequest.GetResponse()时出现异常:
the underlying connection was closed. The server committed a protocol
violation.
当我切换到正常的FTP连接.一切正常.
我错过了建立这个FTPS连接的东西吗?
感谢帮助