场景:c#开发的一个定时上传文件至ftp服务器的程序,很长时间都没有问题。后面ftp服务器(filezilla部署)设置更改了,改为【为FTP启用ssl/tls支持(FTPS)】,上传文件失败,程序报错。System.Net.WebException: 系统错误。 ---> System.Net.InternalException: 系统错误
错误1:System.Net.WebException: 系统错误。 ---> System.Net.InternalException: 系统错误
解决方法: 添加下面两行代码解决
reqFTP.EnableSsl = true;
ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
后续有新的错误
场景:
本地win10家庭中文版操作系统,能够正常执行上传任务。
发布至客户机:win10专业版,出错。
错误信息: System.Net.WebException: 远程服务器返回错误: 150 Opening data channel for file upload to server of "/RADAR/360781A0202306120505.PRZ"
。 ---> System.IO.IOException: 由于远程方已关闭传输流,身份验证失败。
解决方案:将FTP服务器中的设置取消勾选后问题解决