I am not able to transfer text file over FTPS (with TLS). I am able to establish connection with FTPS server. Able to change the directory, but whenever i am trying to upload the file i am getting below log error. I have given both code details as well as error log details. please help.
Below is my code snippet for transferring file through FTPS server.
Chilkat.Ftp2 ftp = new Chilkat.Ftp2();bool success; // Any string unlocks the component for the 1st 30-days. success = ftp.UnlockComponent("Anything for 30-day trial"); if (success != true) { Console.WriteLine(ftp.LastErrorText); return ftp.LastErrorText; } // If this example does not work, try using passive mode // by setting this to true. ftp.Passive = true; ftp.Hostname = parameters.HostName; ftp.Username = parameters.UserName; ftp.Password = parameters.Password; ftp.Port = 20017; // We don't want AUTH SSL: ftp.AuthTls = true; // We want Implicit SSL: ftp.Ssl = false; // Connect and login to the FTP server. success = ftp.Connect(); if (success != true) { Console.WriteLine(ftp.LastErrorText); ftp.Disconnect(); return ftp.LastErrorText; } else { // LastErrorText contains information even when // successful. This allows you to visually verify // that the secure connection actually occurred. Console.WriteLine(ftp.LastErrorText); Console.WriteLine("FTPS Channel Established!"); success = ftp.ChangeRemoteDir("/"); if (success != true) { return ftp.LastErrorText;//Directory Change Error. } else { //string localfilename = "\\hgsqlp14\\Transfer\\BI\\PWC-t\\test.txt"; //string remotefilename = "test.txt"; //byte[] dataBytes = ConvertToArray(fileStream); success = ftp.PutFile("C:\\Test\\test.txt", "test.txt"); if (success != true) { //ftp.Disconnect(); return "---------Upload Error --------- " + ftp.LastErrorText + "---" ;//Upload Error. } else { ftp.Disconnect(); return "File Uploaded sucessfully."; } } }
The Error log got from Chilkat -
---------Upload Error --------- ChilkatLog: PutFile: DllDate: Aug 30 2017 ChilkatVersion: 9.5.0.69 UnlockPrefix: Anything for 30-day trial Architecture: Little Endian; 32-bit Language: .NET 4.5 VerboseLogging: 0 RemoteFilename: test.txt LocalFilename: C:Testtest.txt ProgressMonitoring: enabled: yes heartbeatMs: 0 sendBufferSize: 65536 --ProgressMonitoring IdleTimeoutMs: 60000 ReceiveTimeoutMs: 60000 ConnectTimeoutSeconds: 30 soRcvBuf: 4194304 soSndBuf: 262144 uploadFromLocalFile: localFileSize: 39 uploadFromDataSource: initialGreeting: 220 PwC CFT FTP Server restartNext: 0 modeZ: 0 binaryMode: 1 pbsz_protp: simpleCommand: sendCommand: sendingCommand: PROT P --sendCommand readCommandResponse: replyLineQP: 200 Protection level set to P --readCommandResponse --simpleCommand --pbsz_protp setupDataConnection: passive transfer mode setupPassiveDataSocket: sendCommand: sendingCommand: PASV --sendCommand readCommandResponse: replyLineQP: 227 Entering Passive Mode (172,31,120,157,19,203) --readCommandResponse dataConnect: hostname: 172.31.120.157 port: 5067 socket2Connect: connect2: ConnectFailReason: Connection rejected A few possible causes for a connection being rejected are: - A firewall (software or hardware), such as Windows Firewall, is blocking the connection . - Nothing is listening at the remote host:port --connect2 --socket2Connect dataConnectSuccess: 0 --dataConnect setupPassiveDataSocket dataConnect failed. --setupPassiveDataSocket Failed to setup passive data socket --setupDataConnection Failed to setup data connection for upload. readRepliesAfterFailedDataConn: readCommandResponse: Failed to read beginning of SSL/TLS record. b: 0 dbSize: 0 nReadNBytes: 0 idleTimeoutMs: 1000 Failed to receive more TLS application data. tlsApp: Socket operation timeout. elapsedMs: Elapsed time: 1031 millisec Failed to read FTP control channel reply. readFtpReply: Socket operation timeout. --readCommandResponse --readRepliesAfterFailedDataConn --uploadFromDataSource Failed. --uploadFromLocalFile TotalTime: Elapsed time: 22219 millisec Failed. --PutFile --ChilkatLog