+1 vote

Unfortunately I found same issue again with Active. If u need user & password for testing let me know

this is the code is used for connecting

 Ftp f = new Ftp();

 f.Mode = FtpMode.Active;
 f.ActiveModeAddress = Dns.GetHostEntry(Dns.GetHostName())
      .AddressList.First(x => x.AddressFamily == AddressFamily.InterNetwork);

f.Connect(ftpserver);
f.Login(ftpuser, ftppassword);

List<FtpItem> fitem = f.List();

Console.WriteLine($"Connected to: {ftpserver}");
Debug.WriteLine($"Connected to: {ftpserver}");

foreach (FtpItem FI in fitem)
{
    Console.WriteLine(FI.Name);
    Debug.WriteLine(FI.Name);
}

Logs follow:

52.174.59.196 TEST Server Azure Cloud
Active mode 52.174.59.196 TEST Server Azure Cloud

Ftp.dll Information: 0 : 8 09:53:46 Connecting to '52.174.59.196:21', SSL: False.
Ftp.dll Information: 0 : 8 09:53:46 Control connection uses port: 58294 (227,182)
Ftp.dll Information: 0 : 8 09:53:46 S: 220-Microsoft FTP Service
Ftp.dll Information: 0 : 8 09:53:46 S: 220 Svenni FTP
Ftp.dll Information: 0 : 8 09:53:46 C: USER *****
Ftp.dll Information: 0 : 8 09:53:46 S: 331 Password required
Ftp.dll Information: 0 : 8 09:53:46 C: PASS ****
Ftp.dll Information: 0 : 8 09:53:46 S: 230-Welcome by Svenni FTP
Ftp.dll Information: 0 : 8 09:53:46 S: 230 User logged in.
Ftp.dll Information: 0 : 8 09:53:46 C: FEAT
Ftp.dll Information: 0 : 8 09:53:46 S: 211-Extended features supported:
Ftp.dll Information: 0 : 8 09:53:46 S: LANG EN*
Ftp.dll Information: 0 : 8 09:53:46 S: UTF8
Ftp.dll Information: 0 : 8 09:53:46 S: AUTH TLS;TLS-C;SSL;TLS-P;
Ftp.dll Information: 0 : 8 09:53:46 S: PBSZ
Ftp.dll Information: 0 : 8 09:53:46 S: PROT C;P;
Ftp.dll Information: 0 : 8 09:53:46 S: CCC
Ftp.dll Information: 0 : 8 09:53:46 S: HOST
Ftp.dll Information: 0 : 8 09:53:46 S: SIZE
Ftp.dll Information: 0 : 8 09:53:46 S: MDTM
Ftp.dll Information: 0 : 8 09:53:46 S: REST STREAM
Ftp.dll Information: 0 : 8 09:53:46 S: 211 END
Ftp.dll Information: 0 : 8 09:53:46 C: OPTS UTF8 ON
Ftp.dll Information: 0 : 8 09:53:46 S: 200 OPTS UTF8 command successful - UTF8 encoding now ON.
Ftp.dll Information: 0 : 8 09:53:46 C: TYPE A
Ftp.dll Information: 0 : 8 09:53:46 S: 200 Type set to A.
Ftp.dll Information: 0 : 8 09:53:46 Binding to: 10.218.6.48:0
Ftp.dll Information: 0 : 8 09:53:46 Bound to: 10.218.6.48:0
Ftp.dll Information: 0 : 8 09:53:46 C: PORT 10,218,6,48,227,183
Ftp.dll Information: 0 : 8 09:53:46 S: 200 PORT command successful.
Ftp.dll Information: 0 : 8 09:53:46 C: LIST
Ftp.dll Information: 0 : 8 09:53:46 S: 150 Opening ASCII mode data connection.
Ftp.dll Information: 0 : 8 09:54:16 Limilabs.FTP.Client.FtpException: Remote server has not initiated the connection to '10.218.6.48:58295'.
at  . ()
at  .GetSocket()
at  .  (Action`1 action)
at  . ​(Stream local)
at Limilabs.FTP.Client.Ftp.<>cDisplayClass112_0.b0()
at Limilabs.FTP.Client.Ftp.  (    action)
Ftp.dll Information: 0 : 8 09:54:16 S: 550
Exception thrown: 'Limilabs.FTP.Client.FtpResponseException' in Ftp.dll
52.174.59.196
Ftp.dll Information: 0 : 8 09:54:16 C: QUIT
Ftp.dll Information: 0 : 8 09:54:17 S: 221 Bye


This is the detailed log from FileZilla

Status: Disconnected from server
Status: Connecting to 52.174.59.196:21...
Status: Connection established, waiting for welcome message...
Response: 220-Microsoft FTP Service
Response: 220 Svenni FTP
Command: USER FTPUser
Response: 331 Password required
Command: PASS ********
Response: 230-Welcome by Svenni FTP
Response: 230 User logged in.
Command: OPTS UTF8 ON
Response: 200 OPTS UTF8 command successful - UTF8 encoding now ON.
Status: Logged in
Status: Retrieving directory listing...
Command: PWD
Response: 257 "/" is current directory.
Status: Directory listing of "/" successful

by (301k points)
ok
thanks, but the issue is not only related to Azure
this appearse to be a general issues, the FTP is for testing and granting you rights
Please send us credentials via email.

The error says that the FTP server hasn't connected to your client machine for active mode data transfer.
Isn't 10.218.6.48 your private network address?
This is not the public IP, this is private IP in office.
This is log from FileZilla when I connect to this server

Status:    Disconnected from server
Status:    Connecting to 52.174.59.196:21...
Status:    Connection established, waiting for welcome message...
Response:    220-Microsoft FTP Service
Response:    220 Svenni FTP
Command:    USER FTPUser
Response:    331 Password required
Command:    PASS ********
Response:    230-Welcome by Svenni FTP
Response:    230 User logged in.
Command:    OPTS UTF8 ON
Response:    200 OPTS UTF8 command successful - UTF8 encoding now ON.
Status:    Logged in
Status:    Retrieving directory listing...
Command:    PWD
Response:    257 "/" is current directory.
Status:    Directory listing of "/" successful
10.218.6.48 is your private network address.

Remote server won't be able to connect to this address.

You need to use your public IP address and have the firewall configured in such way it can pass the traffic to your machine.
FZ is using local adress
Command:    PWD
Response:    257 "/" is current directory.
Command:    TYPE I
Response:    200 Type set to I.
Command:    PORT 10,218,6,48,234,241
Response:    200 PORT command successful.
Command:    LIST
Response:    125 Data connection already open; Transfer starting.
Response:    226 Transfer complete.
Status:    Directory listing of "/" successful




if you say "You need to use your public IP address.."
I need to set  f.ActiveModeAddress = <my public adress>
Your router must be translating this address to public address. Private addresses are not available from the Internet.

1 Answer

0 votes

Thank's for the credentials. Here's what I found out:

1.
You can use a private IP as your router for sure changes it to your public one.
This server would return:

C: PORT 192,168,0,11,230,150
S: 501 Server cannot accept argument.

otherwise.

2.
Your problem is most likely with the Windows firewall. Your app must be able to receive remote connections. You can configure that in 2 places:

a)
Please make sure your application is in the allowed programs list:
Control Panel\System and Security\Windows Firewall\Allowed Programs

b)
Windows Firewall with Advanced Security/Inbound rules/New rule

3.
FileZilla works because it is there already (FileZilla installer does that). Obviously Ftp.dll can't change your firewall settings automatically. Most developers wouldn't like that.

by (301k points)
...