Error on Upload (unable to parse server response to SIZE command)

+1 vote
asked Jul 10 by Adesa (190 points)

Hi, I'm getting this error when trying to upload a file to a device that accepts FTP connections. Apparently, before actually uploading the file Rebex tries to check whether the file exists or not using the SIZE command, and it isn't working. I would need just to send the file, with no previous checks.

Here's the log (I've tried with two Upload methods):

2021-07-10 09:03:07.850 Opening log file.
2021-07-10 09:03:07.850 Using FileLogWriter version 2.5.6291.0.
2021-07-10 09:03:07.860 INFO Ftp(1)[4] Info: Connecting to 192.168.1.13:21 using Ftp.
2021-07-10 09:03:07.861 INFO Ftp(1)[4] Info: Assembly: Rebex.Ftp 2017 R2 for .NET 4.0-4.6
2021-07-10 09:03:07.862 DEBUG Ftp(1)[4] Info: Platform: Windows 6.2.9200 32-bit; CLR: 4.0.30319.42000
2021-07-10 09:03:07.862 DEBUG Ftp(1)[4] Info: Culture: es; Windows-1252
2021-07-10 09:03:07.862 INFO Ftp(1)[4] Info: Using proxy none.
2021-07-10 09:03:07.872 DEBUG ProxySocket(2)[4] Socket: Connecting to 192.168.1.13:21.
2021-07-10 09:03:07.877 DEBUG Ftp(1)[4] Info: Connection succeeded.
2021-07-10 09:03:07.881 INFO Ftp(1)[4] Response: 220 - Connection Opened
2021-07-10 09:03:07.886 INFO Ftp(1)[4] Command: USER system
2021-07-10 09:03:07.891 INFO Ftp(1)[4] Response: 331 - Password is Required
2021-07-10 09:03:07.891 INFO Ftp(1)[4] Command: PASS *
2021-07-10 09:03:07.896 INFO Ftp(1)[4] Response: 230 - User logged in
2021-07-10 09:03:07.897 INFO Ftp(1)[4] Command: FEAT
2021-07-10 09:03:07.901 INFO Ftp(1)[4] Response: 202 - Command not supported
...
2021-07-10 09:03:11.611 INFO Ftp(1)[4] Batch: Calling Upload(string = 'LISTAPOZOS.VER', string = 'LISTAPOZOS.VER', TraversalMode = 'Recursive', TransferMethod = 'Copy', ActionOnExistingFiles = 'ThrowException').
2021-07-10 09:03:11.622 DEBUG Ftp(1)[4] Batch: Executing multi-file operation: Uploading, source = 'LISTAPOZOS.VER', target = 'LISTAPOZOS.VER', TransferMethod.Copy, MoveMode.All, LinkProcessingMode.FollowLinks, ActionOnExistingFiles.ThrowException.
2021-07-10 09:03:11.623 DEBUG Ftp(1)[4] Batch: Normalizing source path ('LISTAPOZOS.VER').
2021-07-10 09:03:11.623 DEBUG Ftp(1)[4] Batch: Checking source path ('C:\Users\German\Google Drive\Proyectos\AWTService\AWTService\bin\Debug\LISTA
POZOS.VER').
2021-07-10 09:03:11.626 DEBUG Ftp(1)[4] Batch: Normalizing target path ('LISTAPOZOS.VER').
2021-07-10 09:03:11.627 INFO Ftp(1)[4] Command: PWD
2021-07-10 09:03:11.630 INFO Ftp(1)[4] Response: 257 "/" is the Current Directory
2021-07-10 09:03:11.631 DEBUG Ftp(1)[4] Batch: Checking target path ('/LISTA
POZOS.VER').
2021-07-10 09:03:11.633 INFO Ftp(1)[4] Command: TYPE I
2021-07-10 09:03:11.639 INFO Ftp(1)[4] Response: 200 - TYPE set to I
2021-07-10 09:03:11.641 INFO Ftp(1)[4] Command: MDTM .
2021-07-10 09:03:11.644 INFO Ftp(1)[4] Response: 202 - Command not supported
2021-07-10 09:03:11.644 INFO Ftp(1)[4] Command: SIZE .
2021-07-10 09:03:11.647 INFO Ftp(1)[4] Response: 202 - Command not supported
2021-07-10 09:03:11.647 INFO Ftp(1)[4] Command: MDTM LISTAPOZOS.VER
2021-07-10 09:03:11.651 INFO Ftp(1)[4] Response: 202 - Command not supported
2021-07-10 09:03:11.651 INFO Ftp(1)[4] Command: SIZE LISTA
POZOS.VER
2021-07-10 09:03:11.658 INFO Ftp(1)[4] Response: 202 - Command not supported
2021-07-10 09:03:11.686 ERROR Ftp(1)[4] Info: Rebex.Net.FtpException: Unable to parse server response to SIZE command.
en Rebex.Net.KMG.I(String Q)
en Rebex.Net.Ftp.XD(String Q, Boolean T)
en Rebex.Net.NUG.KB(String Q, MZ T, Boolean B)
en Rebex.Net.NUG.MB(String Q, Boolean T, MZ B)
en Rebex.ZZ.CG(String Q, Boolean T, Boolean B, MZ I)
en Rebex.ZZ.IG()
en Rebex.ZZ.XG(TransferAction Q, UZ T, String B, TransferMethod I, MoveMode U, LinkProcessingMode M, ActionOnExistingFiles Z, MZ R)
en Rebex.Net.Ftp.OH(GZ Q, String T, TransferMethod B, MoveMode I, LinkProcessingMode U, ActionOnExistingFiles M)
2021-07-10 09:03:13.885 INFO Ftp(1)[4] Command: QUIT
2021-07-10 09:03:13.887 INFO Ftp(1)[4] Response: 221 - Connection closing
...
2021-07-10 09:06:50.904 Opening log file.
2021-07-10 09:06:50.904 Using FileLogWriter version 2.5.6291.0.
2021-07-10 09:06:50.913 INFO Ftp(1)[4] Info: Connecting to 192.168.1.13:21 using Ftp.
2021-07-10 09:06:50.914 INFO Ftp(1)[4] Info: Assembly: Rebex.Ftp 2017 R2 for .NET 4.0-4.6
2021-07-10 09:06:50.915 DEBUG Ftp(1)[4] Info: Platform: Windows 6.2.9200 32-bit; CLR: 4.0.30319.42000
2021-07-10 09:06:50.915 DEBUG Ftp(1)[4] Info: Culture: es; Windows-1252
2021-07-10 09:06:50.915 INFO Ftp(1)[4] Info: Using proxy none.
2021-07-10 09:06:50.925 DEBUG ProxySocket(2)[4] Socket: Connecting to 192.168.1.13:21.
2021-07-10 09:06:50.935 DEBUG Ftp(1)[4] Info: Connection succeeded.
2021-07-10 09:06:50.945 INFO Ftp(1)[4] Response: 220 - Connection Opened
2021-07-10 09:06:50.949 INFO Ftp(1)[4] Command: USER system
2021-07-10 09:06:50.956 INFO Ftp(1)[4] Response: 331 - Password is Required
2021-07-10 09:06:50.956 INFO Ftp(1)[4] Command: PASS *
2021-07-10 09:06:50.962 INFO Ftp(1)[4] Response: 230 - User logged in
2021-07-10 09:06:50.962 INFO Ftp(1)[4] Command: FEAT
2021-07-10 09:06:50.965 INFO Ftp(1)[4] Response: 202 - Command not supported
...
2021-07-10 09:06:56.313 INFO Ftp(1)[4] Batch: Calling Upload(string = 'LISTAPOZOS.VER', string = 'LISTAPOZOS.VER', TraversalMode = 'NonRecursive', TransferMethod = 'Copy', ActionOnExistingFiles = 'OverwriteAll').
2021-07-10 09:06:56.321 DEBUG Ftp(1)[4] Batch: Executing multi-file operation: Uploading, source = 'LISTAPOZOS.VER', target = 'LISTAPOZOS.VER', TransferMethod.Copy, MoveMode.All, LinkProcessingMode.FollowLinks, ActionOnExistingFiles.OverwriteAll.
2021-07-10 09:06:56.322 DEBUG Ftp(1)[4] Batch: Normalizing source path ('LISTAPOZOS.VER').
2021-07-10 09:06:56.323 DEBUG Ftp(1)[4] Batch: Checking source path ('C:\Users\German\Google Drive\Proyectos\AWTService\AWTService\bin\Debug\LISTA
POZOS.VER').
2021-07-10 09:06:56.326 DEBUG Ftp(1)[4] Batch: Normalizing target path ('LISTAPOZOS.VER').
2021-07-10 09:06:56.327 INFO Ftp(1)[4] Command: PWD
2021-07-10 09:06:56.330 INFO Ftp(1)[4] Response: 257 "/" is the Current Directory
2021-07-10 09:06:56.332 DEBUG Ftp(1)[4] Batch: Checking target path ('/LISTA
POZOS.VER').
2021-07-10 09:06:56.334 INFO Ftp(1)[4] Command: TYPE I
2021-07-10 09:06:56.339 INFO Ftp(1)[4] Response: 200 - TYPE set to I
2021-07-10 09:06:56.339 INFO Ftp(1)[4] Command: MDTM .
2021-07-10 09:06:56.345 INFO Ftp(1)[4] Response: 202 - Command not supported
2021-07-10 09:06:56.346 INFO Ftp(1)[4] Command: SIZE .
2021-07-10 09:06:56.349 INFO Ftp(1)[4] Response: 202 - Command not supported
2021-07-10 09:06:56.349 INFO Ftp(1)[4] Command: MDTM LISTAPOZOS.VER
2021-07-10 09:06:56.352 INFO Ftp(1)[4] Response: 202 - Command not supported
2021-07-10 09:06:56.352 INFO Ftp(1)[4] Command: SIZE LISTA
POZOS.VER
2021-07-10 09:06:56.357 INFO Ftp(1)[4] Response: 202 - Command not supported
2021-07-10 09:06:56.387 ERROR Ftp(1)[4] Info: Rebex.Net.FtpException: Unable to parse server response to SIZE command.
en Rebex.Net.KMG.I(String Q)
en Rebex.Net.Ftp.XD(String Q, Boolean T)
en Rebex.Net.NUG.KB(String Q, MZ T, Boolean B)
en Rebex.Net.NUG.MB(String Q, Boolean T, MZ B)
en Rebex.ZZ.CG(String Q, Boolean T, Boolean B, MZ I)
en Rebex.ZZ.IG()
en Rebex.ZZ.XG(TransferAction Q, UZ T, String B, TransferMethod I, MoveMode U, LinkProcessingMode M, ActionOnExistingFiles Z, MZ R)
en Rebex.Net.Ftp.OH(GZ Q, String T, TransferMethod B, MoveMode I, LinkProcessingMode U, ActionOnExistingFiles M)
2021-07-10 09:06:58.960 INFO Ftp(1)[4] Command: QUIT
2021-07-10 09:06:58.967 INFO Ftp(1)[4] Response: 221 - Connection closing

Thanks and regards,
German Martinez

Applies to: Rebex FTP/SSL

1 Answer

0 votes
answered Jul 10 by Adesa (190 points)

I'll answer myself. I've been looking at the examples and figured out I should have used PutFile method, instead of Upload.

I've just replaced that and it worked fine.

Thanks and regards,
German

commented Jul 12 by Lukas Pokorny (126,870 points)
Yes, using PutFile method is the correct solution.

In general, the following complex methods only work with servers where it's reliably possible to detect existence of an item: Upload, Download, Delete, GetItems, FileExists, DirectoryExists.
...