附加信息:基础连接已关闭:连接意外关闭

时间:2019-04-15 10:23:50

标签: c# webclient

我有以下代码。无论我如何尝试,它都无法连接。

 WebClient client = new WebClient();
 client.Credentials = new NetworkCredential(Login, Password);


ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

ServicePointManager.ServerCertificateValidationCallback =
 (sender, cert,chain,error) => true;


client.UploadFile("MyhttpsLink", WebRequestMethods.Ftp.UploadFile,"D:\\test.csv");

1:预期结果:我需要将该文件上传到我的FTP链接

2:实际结果:其他信息:基础连接已关闭:连接意外关闭。

0 个答案:

没有答案