错误提示 :由于远程方已关闭传输流,身份验证失败?
client = new FtpClient("127.0.0.1");
client.Credentials = new NetworkCredential("test1", "123456");
client.EncryptionMode = FtpEncryptionMode.Explicit;
client.ValidateCertificate += new FtpSslValidation(OnValidateCertificate);
client.Connect();
string localPath = @"D:\work\document\临时信息1.txt";
string remotePath =@"/临时信息.txt";
client.DownloadFile(localPath, remotePath);
---报错:由于远程方已关闭传输流,身份验证失败
解决方法:
client.Connect();
换成:
client.AutoConnect();
我也不知道为什么,关于这个方法的解释如下
and
供后人参考