WinSCP .NET库FTP传输失败,并显示“控制的IP地址和数据连接不匹配". [英] WinSCP .NET library FTP transfer fails with "IP addresses of control and data connection do not match"

查看:358
本文介绍了WinSCP .NET库FTP传输失败,并显示“控制的IP地址和数据连接不匹配".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用WinSCP .NET程序集实现了FTP代码,并将其托管在Azure AppService上.

I have implemented FTP code with use of WinSCP .NET assembly and hosted it on an Azure AppService.

它可以在本地和Azure上运行.

It works locally and on Azure.

但是在很少的随机时间内,当托管在Azure上时,它会引发以下错误:

But in very few random times, when hosted on Azure, it throws the following error:

传输文件'D:\ local \ Temp \ test_settings.txt'时出错.服务器使用主机地址发送了无法回复的地址为10.YYY.YYY.YYY的被动答复.将文件复制到远程端失败.传输"/test_settings.txt"的数据连接被拒绝,控件的IP地址和数据连接不匹配

Error transferring file 'D:\local\Temp\test_settings.txt'. Server sent passive reply with unroutable address 10.YYY.YYY.YYY, using host address instead. Copying files to remote side failed. Rejected data connection for transfer of "/test_settings.txt", IP addresses of control and data connection do not match

由于IP以10开头,是否表示它在FTP服务器的网络中是本地的? 我可以做些改善实施的事情吗?

Since the IP starts with 10. does that mean that it's local in the FTP server's network? Can I do something to improve the implementation?

您认为该解决方案在被多个请求同时使用时会出现问题吗?

Do you think that the solution will have a problem when used concurrently by multiple requests?

我的代码是简单的C#示例的副本,具有以下设置:

My code is a copy of the Simple C# example with the following settings:

SessionOptions sessionOptions = new SessionOptions
{
  Protocol = Protocol.Ftp,
  UserName = username,
  Password = password,
  GiveUpSecurityAndAcceptAnyTlsHostCertificate = true,
  FtpSecure = FtpSecure.Explicit,
  HostName = 'ftp.domain.com'
};

推荐答案

控制和数据连接的IP地址不匹配

IP addresses of control and data connection do not match

这是FileZilla FTP服务器发出的消息.这是一种安全措施.它可能表明您的应用服务实例的外部IP地址在传输过程中发生了更改.或者,当然,这可能表明您的连接已被劫持(这是服务器试图检测到的).

That's a message from FileZilla FTP server. It's a security measure. It might indicate that external IP address of your app service instance changed mid transfer. Or of course, it might indicate that you connection was hijacked (that's what the server tries to detect).

与WinSCP无关.

我不知道Azure应用程序服务的IP地址是否可以某种方式固定.如果没有,您所能做的就是重新连接并重试传输.我相信您在使用任何FTP客户端时都会遇到相同的问题.也许使用IPv6连接,该问题就不会发生.但是我不确定,这只是一个疯狂的猜测.尽管您不能通过WinSCP强制使用IPv6(只能完全禁用IPv4,但我不知道使用应用程序服务是否还可以这样做).

I do not know if the IP address of the Azure app service can be fixed somehow. If not, all you can do is to reconnect and retry the transfer. I believe you would have the same problem with any FTP client. Maybe with IPv6 connection, the problem would not happen. But I'm not sure, it's just a wild guess. Though you cannot force IPv6 with WinSCP (only by disabling IPv4 altogether, but I do not know if that's even possible with the app service).

这篇关于WinSCP .NET库FTP传输失败,并显示“控制的IP地址和数据连接不匹配".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆