FluentFTP icon indicating copy to clipboard operation
FluentFTP copied to clipboard

FTPClient Failed to get list from one PC and success from another PC

Open SahaGoutam opened this issue 5 years ago • 3 comments

FTP OS: Windows

Computer OS: 2008 R2

FluentFTP Version: 19.1.2.0

Runtime Version : v4.0.30319

First of all: Great job. Its a very easy to use and powerfull library.

I wrote a program on my Windows 10 PC using FluentFTP to login and download files from a FTP server and it works fine.

However, when I deployed the program on another Windows 2008 systems it can connect to the FTP server but it is not being able to get the File List.

I tested with FileZilla on both machine and both are working fine. FileZilla setup with the option of "Require explicit FTP over TLS".

Please suggest me, where I am wrong.

For the reference I am sending the client settings and log below.

Client Config: client.Host = host; client.Port = port; client.RetryAttempts = base.RetryCount; client.Credentials = new NetworkCredential(base.UserName, base.Password); client.EncryptionMode =FtpEncryptionMode.Explicit; client.SocketKeepAlive = true; client.DataConnectionType = FtpDataConnectionType.AutoPassive; client.SslProtocols = System.Security.Authentication.SslProtocols.Tls12; client.ValidateCertificate += ((sender, e) => { e.Accept = true; });

Log: 2020-03-23 16:44:04,781 - FTP Connected. 2020-03-23 16:44:04,781 - [----] Successfully connected to the FTP. 2020-03-23 16:44:04,786 - Getting file list from FTP path (/). 2020-03-23 16:44:04,787 - FTP working directory (/). 2020-03-23 16:44:05,175 - Failed to get list from FTP FluentFTP.FtpCommandException: SSL connection failed; session reuse required: see require_ssl_reuse option in vsftpd.conf man page at FluentFTP.FtpClient.CloseDataStream(FtpDataStream stream) at FluentFTP.FtpDataStream.Close()

SahaGoutam avatar Mar 27 '20 06:03 SahaGoutam

Wrong connection profile. Try using client.AutoDetect() on the target machine. See https://github.com/robinrodricks/FluentFTP/wiki/Automatic-Connection

robinrodricks avatar Mar 30 '20 06:03 robinrodricks

Hi,

First of all: thanks for your replay.

If you see the log, where I mentioned that the FTPS is connected. But program throwing exception when I getting the file list from FTPS.

however, I will check and let you know.

SahaGoutam avatar Mar 31 '20 10:03 SahaGoutam

@SahaGoutam I'm getting the same issue. I've tried a few different libraries. It works perfectly in Filezilla.

@robinrodricks I've attached my full log. `

Connect()

Status: Connecting to xxx.xxx.xxx.224:21 Response: 220---------- Welcome to Pure-FTPd [privsep] [TLS] ---------- Response: 220-You are user number 2 of 50 allowed. Response: 220-Local time is now 00:42. Server port: 21. Response: 220-This is a private system - No anonymous login Response: 220 You will be disconnected after 15 minutes of inactivity. Status: Detected FTP server: PureFTPd Command: AUTH TLS Response: 234 AUTH TLS OK. Status: FTPS Authentication Successful Status: Time to activate encryption: 0h 0m 0s. Total Seconds: 0.2804689. Command: USER [email protected] Response: 331 User [email protected] OK. Password required Command: PASS *** Response: 230 OK. Current restricted directory is / Command: PBSZ 0 Response: 200 PBSZ=0 Command: PROT P Response: 200 Data protection level set to "private" Command: FEAT Response: 211-Extensions supported: Response: EPRT Response: IDLE Response: MDTM Response: SIZE Response: MFMT Response: REST STREAM Response: MLST type*;size*;sizd*;modify*;UNIX.mode*;UNIX.uid*;UNIX.gid*;unique*; Response: MLSD Response: AUTH TLS Response: PBSZ Response: PROT Response: UTF8 Response: TVFS Response: ESTA Response: PASV Response: EPSV Response: SPSV Response: ESTP Response: 211 End. Status: Text encoding: System.Text.UTF8Encoding Command: OPTS UTF8 ON Response: 200 OK, UTF-8 enabled Command: SYST Response: 215 UNIX Type: L8

SetWorkingDirectory("/xxx/in")

Command: CWD /xx/in Response: 250 OK. Current directory is /xxx/in

GetWorkingDirectory()

Command: PWD Response: 257 "/xxx/in" is your current location

UploadFile("C:\Users\pmbliss\Documents\Visual Studio 2017\Projects\ConsoleApp4\TestFTPS\bin\Debug\1.jpg", "1.jpg", Overwrite, False, None)

FileExists("1.jpg")

GetWorkingDirectory()

Command: PWD Response: 257 "/xxx/in" is your current location Command: SIZE /xxx/in/1.jpg Response: 550 Can't check for file existence

OpenWrite("1.jpg", Binary)

Command: TYPE I Response: 200 TYPE is now 8-bit binary

OpenPassiveDataStream(PASV, "STOR 1.jpg", 0)

Command: PASV Response: 227 Entering Passive Mode (xxx,xxx,xxx,224,206,56) Status: Connecting to xxx.xxx.xxx.224:52792 Command: STOR 1.jpg Response: 150 Accepted data connection Status: FTPS Authentication Successful Status: Time to activate encryption: 0h 0m 0s. Total Seconds: 0.1362305. Status: Disposing FtpSocketStream...

OpenAppend("1.jpg", Binary)

GetFileSize("1.jpg")

Command: SIZE 1.jpg Status: Disposing FtpSocketStream... `

pmathbliss avatar May 13 '20 00:05 pmathbliss

Unsure how to fix this. Closing for now.

robinrodricks avatar Sep 26 '22 02:09 robinrodricks