0 votes
by (120 points)

I am using a 3rd party Visual Studio add-in that uses Rebex.FTP to upload web projects.

For some reason, I can't use ACTIVE movde to connect to my server. Passive isn't an option, so I need to get active to work.

I can use another FTP client and connect to the same server in active mode with no problem.

I turned on logging from the VS add-in and here are the last few lines:

1/25/2011 10:28:58 AM    REPLY - 215 Windows_NT
1/25/2011 10:28:58 AM    COMMAND - PWD
1/25/2011 10:28:58 AM    REPLY - 257 "/" is current directory.
1/25/2011 10:28:58 AM    COMMAND - TYPE A
1/25/2011 10:28:58 AM    REPLY - 200 Type set to A.
1/25/2011 10:28:58 AM    COMMAND - PORT 127,0,0,1,12,120
1/25/2011 10:28:58 AM    REPLY - 501 Server cannot accept argument.
1/25/2011 10:28:59 AM    COMMAND - QUIT
1/25/2011 10:28:59 AM    REPLY - 221 Goodbye.

Here is a log from the other client that does work:

230 User logged in.
257 "/" is current directory.
PORT 192,168,50,20,12,211
200 PORT command successful.
125 Data connection already open; Transfer starting.
226 Transfer complete.
646 bytes received/sent in 0 seconds

The difference is in the PORT command. Rebex is using, the other client uses and it works fine.

I have even downloaded the Rebex sample console client and IT WORKS against this same server.

So my question is: How is Rebex deciding to use my LOCALHOST IP address in the PORT command? And can anything be done programatically to correct this?

Applies to: Rebex FTP/SSL
by (120 points)
I just remember I had an old Visual Studio 2003 FTP plugin called UnleashIt still installed. I tested it against this new server and am getting the SAME RESULT! I captured the packets and verified that even this much older software is issuing a PORT 127,0,0,1 command. I am on Windows XP SP2 (old I know) and the Windows Firewall is turned off. My AV is ESET NOD32. No other firewall software is installed. I disabled ESET and still have the same problem.

3 Answers

0 votes
by (146k points)

The PORT command sent by the VS add-in has an IP equivalent of "localhost" in it. This would only work if the FTP server runs at the same machine as VS...

The process by which Rebex FTP decides which IP address to send is simple:

  1. By default, the IP is determined from the LocalEndPoint property of the System.Net.Sockets.Socket instance currently used by the control connection. This would only contain if Rebex FTP was connected to an endpoint at the same machine.
  2. If Ftp object's DataAddress property is set, the specified IP is used. This can be used to override the default behavior.

If Rebex samples work fine, the most likely explanation is that the VS add-in sets DataAddress property to a bad value for some reason. This property is only used in active mode, so the majority of users who use passive mode wouldn't notice. A majority of active mode users should never need to set the property either.

Try reporting this issue to VS add-in vendor, they should be able to fix it easily.

0 votes
by (140 points)

The DataAddress is not being set explicitly anywhere in code. The server address & port (specified by the user) are passed to the BeginConnect method.

this.Client.BeginConnect(_serverAddress, _serverPort, null, null);

by (146k points)
If DataAddress is not being set explicitly anywhere in the code, then the only possible reason for sending to the server is that LocalEndPoint property of System.Net.Sockets.Socket returned a local endpoint with in it. Do you call Ftp object's SetSocketFactory method or use any kind of proxy? That might also be the reason.
by (146k points)
Please let us know where we can download this VS add-in and reproduce the problem ourselves. That would make it possible to quickly tell what is going on for sure without trying to guess the reason :-)
by (120 points)
by (146k points)
Thanks, Roger! I created a set of Rebex FTP/SSL DLLs you can try using instead of the ones that came with Dispatch installation. I sent a link to it to your e-mail addresses. These DLLs should create a RebexLog.txt log file in your temporary folder that should make it possible for us to tell what is going on. Please create a log of the PORT 127,0,0,1 issue and mail the log file to us for analysis.
0 votes
by (140 points)

RE: Do you call Ftp object's SetSocketFactory method or use any kind of proxy?

Nope. Just a typical straight connection.