FtpStatus status = ftpConnection.UploadFile(file, remoteFile, FtpRemoteExists.Skip, false, FtpVerify.None);
< /code>
или это: < /p>
FtpStatus status = ftpConnection.UploadFile(file, remoteFile);
Тогда статус является успешным , но когда я перехожу, файл не загружается.
Возможно ли, что файл есть, но я не вижу его с Filezilla по какой -то причине? Статус - это успех , но FileExists возвращает false .
FtpStatus status = ftpConnection.UploadFile(file, remoteFile, FtpRemoteExists.Skip, false, FtpVerify.None);
if (status == FtpStatus.Success)
{
if (ftpConnection.FileExists(remoteFile))
{
result = LogAndMoveFile(file, ClassDataBase.IMPORT_EXPORT_SUCCEEDED, "");
}
else
{
// HOW IS IT POSSIBLE I GET HERE ??????
throw new Exception($"File Upload Status is success, but the file is not uploaded");
}
}
edit #3
Вот журнал от fluentftp для fileupload и fileexists :
// HERE THE EXCEPTION IS THROWN FtpStatus status = ftpConnection.UploadFile(file, remoteFile, FtpRemoteExists.Skip, false, FtpVerify.Throw);
if (status == FtpStatus.Success) { result = LogAndMoveFile(file, ClassDataBase.IMPORT_EXPORT_SUCCEEDED, ""); } else { throw new Exception($"File Upload Status {status.ToString()}"); } } } catch (Exception ex) { result = LogAndMoveFile(fileForLogging, ClassDataBase.IMPORT_EXPORT_FAILED, ex.Message); } } finally { ftpConnection.Disconnect(); } } < /code> Значение переменных, когда: < /p> FtpStatus status = ftpConnection.UploadFile(file, remoteFile, FtpRemoteExists.Skip, false, FtpVerify.Throw); [/code] is rek: [list] [*] file = "c: \ test \ somefile.edi" remotefile = "/in/somefile.edi" pilezer folder/br/> [/list] В существует, я также могу загружать файлы в этот каталог, используя Filezilla, поэтому есть каталог, и права в порядке. Что я делаю не так?[code] FtpStatus status = ftpConnection.UploadFile(file, remoteFile, FtpRemoteExists.Skip, false, FtpVerify.None); < /code> или это: < /p> FtpStatus status = ftpConnection.UploadFile(file, remoteFile); [/code] Тогда статус является успешным , но когда я перехожу, файл не загружается. Возможно ли, что файл есть, но я не вижу его с Filezilla по какой -то причине? Статус - это успех , но FileExists возвращает false . [code] FtpStatus status = ftpConnection.UploadFile(file, remoteFile, FtpRemoteExists.Skip, false, FtpVerify.None);
if (status == FtpStatus.Success) { if (ftpConnection.FileExists(remoteFile)) { result = LogAndMoveFile(file, ClassDataBase.IMPORT_EXPORT_SUCCEEDED, ""); } else { // HOW IS IT POSSIBLE I GET HERE ?????? throw new Exception($"File Upload Status is success, but the file is not uploaded"); } } [/code] edit #3 Вот журнал от fluentftp для fileupload и fileexists :
[code][24/04/2025 15:18:02] [Info] > Connect(False) [24/04/2025 15:18:02] [Verbose] FluentFTP 52.1.0.0(.NET Framework 4.7.2) FtpClient [24/04/2025 15:18:02] [Verbose] Connecting(sync) FtpClient.FtpSocketStream(control) IP #1 = ***:10021 [24/04/2025 15:18:02] [Verbose] Waiting for a response [24/04/2025 15:18:02] [Verbose] Response: 220-Welcome to the DINET FTP Server. Response: 220-Please proceed to log in with the username [24/04/2025 15:18:02] [Info] Response: 220 and password given to you by your trading partner. [739364,554d] [24/04/2025 15:18:02] [Info] Command: AUTH TLS [24/04/2025 15:18:02] [Verbose] Waiting for response to: AUTH TLS [24/04/2025 15:18:02] [Info] Response: 500 Command not recognised. [18ms] [24/04/2025 15:18:02] [Info] Command: USER *** [24/04/2025 15:18:02] [Verbose] Waiting for response to: USER *** [24/04/2025 15:18:02] [Info] Response: 331 Now please specify password. [20ms] [24/04/2025 15:18:02] [Info] Command: PASS *** [24/04/2025 15:18:02] [Verbose] Waiting for response to: PASS *** [24/04/2025 15:18:03] [Info] Response: 230 Welcome to the EPIC FTP service. [98ms] [24/04/2025 15:18:03] [Info] Command: FEAT [24/04/2025 15:18:03] [Verbose] Waiting for response to: FEAT [24/04/2025 15:18:03] [Info] Response: 500 Command not recognised. [20ms] [24/04/2025 15:18:03] [Info] Text encoding: System.Text.SBCSCodePageEncoding [24/04/2025 15:18:03] [Info] Command: SYST [24/04/2025 15:18:03] [Verbose] Waiting for response to: SYST [24/04/2025 15:18:03] [Info] Response: 215 UNIX EPIC [22ms] [24/04/2025 15:18:03] [Verbose] Active ServerHandler is: None [24/04/2025 15:18:03] [Verbose] Listing parser set to: Unix [24/04/2025 15:18:03] [Info] Command: PWD [24/04/2025 15:18:03] [Verbose] Waiting for response to: PWD [24/04/2025 15:18:03] [Info] Response: 257 "/" [23ms] [24/04/2025 15:18:03] [Info] > SetWorkingDirectory("/In") [24/04/2025 15:18:03] [Info] Command: CWD /In [24/04/2025 15:18:03] [Verbose] Waiting for response to: CWD /In [24/04/2025 15:18:03] [Info] Response: 250 Current directory is now /In. [16ms] [24/04/2025 15:18:03] [Info] > UploadFile("\\SRV-GTT-FILE01\PalmDocuments\EDI\Ford\VoertuigenAfmelden\GTT_20250421_135758_27942.EDI", "GTT_20250421_135758_27942.EDI", Skip, False, None) [24/04/2025 15:18:03] [Info] > FileExists("GTT_20250421_135758_27942.EDI") [24/04/2025 15:18:03] [Info] > GetNameListing("/In") [24/04/2025 15:18:03] [Info] Command: TYPE I [24/04/2025 15:18:03] [Verbose] Waiting for response to: TYPE I [24/04/2025 15:18:03] [Info] Response: 200 Ok. [20ms] [24/04/2025 15:18:03] [Info] > OpenDataStream("NLST /In", 0) [24/04/2025 15:18:03] [Info] > OpenPassiveDataStream(PASV, "NLST /In", 0) [24/04/2025 15:18:03] [Info] Command: PASV [24/04/2025 15:18:03] [Verbose] Waiting for response to: PASV [24/04/2025 15:18:03] [Info] Response: 227 (20,49,162,160,117,48) [290ms] [24/04/2025 15:18:03] [Verbose] Connecting(sync) FtpClient.FtpSocketStream(data) IP #1 = ***:30000 [24/04/2025 15:18:03] [Info] Command: NLST /In [24/04/2025 15:18:03] [Verbose] Waiting for response to: NLST /In [24/04/2025 15:18:03] [Info] Response: 150 Opening data connection for transfer of information. [46ms] [24/04/2025 15:18:03] [Verbose] +---------------------------------------+ [24/04/2025 15:18:03] [Verbose] Disposing(sync) FtpClient.FtpSocketStream(data) [24/04/2025 15:18:03] [Info] > CloseDataStream() [24/04/2025 15:18:03] [Verbose] Waiting for response to: NLST /In [24/04/2025 15:18:03] [Info] Response: 226 Ok. [46ms] [24/04/2025 15:18:03] [Verbose] ----------------------------------------- [24/04/2025 15:18:03] [Verbose] Disposing(sync) FtpClient.FtpSocketStream(data) (redundant) [24/04/2025 15:18:03] [Info] > OpenWrite("GTT_20250421_135758_27942.EDI", Binary, -1, False) [24/04/2025 15:18:03] [Info] > OpenDataStream("STOR GTT_20250421_135758_27942.EDI", 0) [24/04/2025 15:18:03] [Info] > OpenPassiveDataStream(PASV, "STOR GTT_20250421_135758_27942.EDI", 0) [24/04/2025 15:18:03] [Info] Command: PASV [24/04/2025 15:18:03] [Verbose] Waiting for response to: PASV [24/04/2025 15:18:03] [Info] Response: 227 (20,49,162,160,117,48) [26ms] [24/04/2025 15:18:03] [Verbose] Connecting(sync) FtpClient.FtpSocketStream(data) IP #1 = ***:30000 [24/04/2025 15:18:03] [Info] Command: STOR GTT_20250421_135758_27942.EDI [24/04/2025 15:18:03] [Verbose] Waiting for response to: STOR GTT_20250421_135758_27942.EDI [24/04/2025 15:18:03] [Info] Response: 125 Data connection connected, starting transfer. [199ms] [24/04/2025 15:18:03] [Verbose] Uploaded 1024 bytes, FileExists("GTT_20250421_135758_27942.EDI") [24/04/2025 15:18:03] [Info] > GetNameListing("/In") [24/04/2025 15:18:03] [Info] > OpenDataStream("NLST /In", 0) [24/04/2025 15:18:03] [Info] > OpenPassiveDataStream(PASV, "NLST /In", 0) [24/04/2025 15:18:03] [Info] Command: PASV [24/04/2025 15:18:03] [Verbose] Waiting for response to: PASV [24/04/2025 15:18:04] [Info] Response: 227 (20,49,162,160,117,48) [26ms] [24/04/2025 15:18:04] [Verbose] Connecting(sync) FtpClient.FtpSocketStream(data) IP #1 = ***:30000 [24/04/2025 15:18:04] [Info] Command: NLST /In [24/04/2025 15:18:04] [Verbose] Waiting for response to: NLST /In [24/04/2025 15:18:04] [Info] Response: 150 Opening data connection for transfer of information. [41ms] [24/04/2025 15:18:04] [Verbose] +---------------------------------------+ [24/04/2025 15:18:04] [Verbose] Listing: GTT_20250421_135758_27942.EDI [24/04/2025 15:18:04] [Verbose] Disposing(sync) FtpClient.FtpSocketStream(data) [24/04/2025 15:18:04] [Info] > CloseDataStream() [24/04/2025 15:18:04] [Verbose] Waiting for response to: NLST /In [24/04/2025 15:18:04] [Info] Response: 226 Ok. [51ms] [24/04/2025 15:18:04] [Verbose] ----------------------------------------- [24/04/2025 15:18:04] [Verbose] Disposing(sync) FtpClient.FtpSocketStream(data) (redundant) [24/04/2025 15:18:04] [Info] > Disconnect() [24/04/2025 15:18:04] [Info] Command: QUIT [24/04/2025 15:18:04] [Verbose] Waiting for response to: QUIT [24/04/2025 15:18:04] [Info] Response: 221 Service is closing. [24ms] [24/04/2025 15:18:04] [Verbose] Disposing(sync) FtpClient.FtpSocketStream(control) [24/04/2025 15:18:04] [Info] > Dispose() [24/04/2025 15:18:04] [Verbose] Disposing(sync) FtpClient [24/04/2025 15:18:04] [Info] > Disconnect() [24/04/2025 15:18:04] [Verbose] Connection already closed, nothing to do. [24/04/2025 15:18:04] [Verbose] Disposing(sync) FtpClient.FtpSocketStream(control) (redundant) [/code]
Когда я загружаю определенный файл с FTP, он теряет конфигурацию. Это отчет в формате .txt размером 200 МБ, содержащий более 2 миллионов строк, из ERP-системы.
С помощью WinSCP я выбираю вариант загрузки в виде ТЕКСТА — единственный способ загрузки....
Я пытаюсь открыть FTP -соединение по SSL в моем коде. Я могу подключить и перечислить каталог, используя Filezilla of Winscp. Но при перечислении каталога через код .net с использованием ftpwebclient я получаю ошибку