Я пытаюсь загрузить файл, используя FluentFtp, но он продолжает возвращать ошибку < /p>
fluentftp.exceptions.ftpexception
hresult = 0x80131500
message = uppexted file value не соответствует локальному файлу
fluent = fluent = fluent = fluent = fluent = fluent = fluent = fluent = fluent = fluent = fluent = fluent = fluent = flulet Fluentftp.ftpclient.uploadfileFromFile (String LocalPath, String remotePath, Boolean Createremotedir, ftpremoteexists ExcistsMode, Boolean FileExists, Boolean FileExist1 progress, FtpProgress metaProgress) at FluentFTP.FtpClient.UploadFile(String localPath, String remotePath, FtpRemoteExists existsMode, Boolean createRemoteDir, FtpVerify verifyOptions, Action< /code> 1 Прогресс)
at gttxmlimportexportservice.classftpthread.putfilelistusing_fluentftp (String filename) в C: Devops \ WindowsServices \ Gttxmlimportexportservice \ classftpthread.cs: Стоя 522 < /p>
execkers \ /> fluentftp.ftpclient.uploadfileFromFile(String, String, Bool, FluentFtp.ftpremoteexists, Bool, Bool, Fluentftp.ftpverify, System.Action , fluentftp.ftprogress) Fluentftp.ftpremoteexists, bool, fluentftp.ftpverify, system.action )
gttxmlimportexportservice.classftpthread.putfilelistusing_fluentftp(string) в классе. это < /p>
using (FluentFTP.FtpClient ftpConnection = new FluentFTP.FtpClient())
{
FtpProfile ftpProfile = new FtpProfile();
ftpProfile.Credentials = new System.Net.NetworkCredential(_ftpDefinition.UserName, _ftpDefinition.PassWord);
ftpProfile.Host = _ftpDefinition.Host;
ftpProfile.Protocols = System.Security.Authentication.SslProtocols.Default;
ftpProfile.Encoding = System.Text.Encoding.UTF8;
ftpConnection.Port = _ftpDefinition.Port;
try
{
string currentFile = "";
string fileForLogging = "";
string remoteFile = "";
try
{
ftpConnection.Connect(ftpProfile);
//ftpConnection.SetWorkingDirectory(remoteDir);
foreach (string file in files)
{
fileForLogging = file;
currentFile = Path.GetFileName(file);
_fileName = currentFile;
remoteFile = remoteDir + @"/" + currentFile;
// 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>
Значение переменных, когда ftpstatus status = ftpconnection.uploadfile (file, remotefile, ftpremoteexists.skip, false, ftpverify.throw); < /code> называется < /p>
file = "co: \ test \ test. «/In/somefile.edi"
Я использую Filezilla, чтобы проверить, что папка в существует, я также могу загружать файлы в этот каталог, используя Filezilla, так что в каталоге есть права, а права
edit edit edit edit edit edit edit edit
. это < /p>
FtpStatus status = ftpConnection.UploadFile(file, remoteFile, FtpRemoteExists.Skip, false, FtpVerify.None);
< /code>
или это < /p>
FtpStatus status = ftpConnection.UploadFile(file, remoteFile);
Тогда статус - это успех , но когда я перехожу, файл не загружается.
Возможно ли, что файл есть, но я не вижу его с помощью Filezilla по какой -то причине? false. < /p>
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
Вот журнал от fluentftp для файлов и файлов
[24/04/2025 13:54:51] [Info] > Connect(False)
[24/04/2025 13:54:58] [Verbose] FluentFTP 52.1.0.0(.NET Framework 4.7.2) FtpClient
[24/04/2025 13:55:05] [Verbose] Connecting(sync) FtpClient.FtpSocketStream(control) IP #1 = ***:10021
[24/04/2025 13:55:07] [Verbose] Waiting for a response
[24/04/2025 13:55:08] [Verbose] Response: 220-Welcome to the DINET FTP Server.
Response: 220-Please proceed to log in with the username
[24/04/2025 13:55:09] [Info] Response: 220 and password given to you by your trading partner. [739364,497d]
[24/04/2025 13:55:10] [Info] Command: USER ***
[24/04/2025 13:55:11] [Verbose] Waiting for response to: USER ***
[24/04/2025 13:55:12] [Info] Response: 331 Now please specify password. [722ms]
[24/04/2025 13:55:13] [Info] Command: PASS ***
[24/04/2025 13:55:14] [Verbose] Waiting for response to: PASS ***
[24/04/2025 13:55:14] [Info] Response: 230 Welcome to the EPIC FTP service. [538ms]
[24/04/2025 13:55:15] [Info] Command: FEAT
[24/04/2025 13:55:15] [Verbose] Waiting for response to: FEAT
[24/04/2025 13:55:16] [Info] Response: 500 Command not recognised. [497ms]
[24/04/2025 13:55:16] [Info] Text encoding: System.Text.UTF8Encoding
[24/04/2025 13:55:17] [Info] Command: OPTS UTF8 ON
[24/04/2025 13:55:17] [Verbose] Waiting for response to: OPTS UTF8 ON
[24/04/2025 13:55:18] [Info] Response: 500 Command not recognised. [539ms]
[24/04/2025 13:55:18] [Info] Command: SYST
[24/04/2025 13:55:19] [Verbose] Waiting for response to: SYST
[24/04/2025 13:55:20] [Info] Response: 215 UNIX EPIC [699ms]
[24/04/2025 13:55:21] [Verbose] Active ServerHandler is: None
[24/04/2025 13:55:21] [Verbose] Listing parser set to: Unix
[24/04/2025 13:55:22] [Info] Command: PWD
[24/04/2025 13:55:22] [Verbose] Waiting for response to: PWD
[24/04/2025 13:55:23] [Info] Response: 257 "/" [598ms]
[24/04/2025 13:55:27] [Info] > UploadFile("\\SRV-GTT-FILE01\PalmDocuments\EDI\Ford\VoertuigenAfmelden\GTT_20250421_135758_27942.EDI", "/In/GTT_20250421_135758_27942.EDI", Skip, False, None)
[24/04/2025 13:55:30] [Info] > FileExists("/In/GTT_20250421_135758_27942.EDI")
[24/04/2025 13:55:34] [Info] > GetNameListing("/In")
[24/04/2025 13:55:35] [Info] Command: TYPE I
[24/04/2025 13:55:36] [Verbose] Waiting for response to: TYPE I
[24/04/2025 13:55:37] [Info] Response: 200 Ok. [857ms]
[24/04/2025 13:55:37] [Info] > OpenDataStream("NLST /In", 0)
[24/04/2025 13:55:38] [Info] > OpenPassiveDataStream(PASV, "NLST /In", 0)
[24/04/2025 13:55:39] [Info] Command: PASV
[24/04/2025 13:55:39] [Verbose] Waiting for response to: PASV
[24/04/2025 13:55:40] [Info] Response: 227 (20,49,162,160,117,48) [639ms]
[24/04/2025 13:55:40] [Verbose] Connecting(sync) FtpClient.FtpSocketStream(data) IP #1 = ***:30000
[24/04/2025 13:55:41] [Info] Command: NLST /In
[24/04/2025 13:55:44] [Verbose] Waiting for response to: NLST /In
[24/04/2025 13:55:45] [Info] Response: 150 Opening data connection for transfer of information. [1,129s]
[24/04/2025 13:55:46] [Verbose] +---------------------------------------+
[24/04/2025 13:55:46] [Verbose] Disposing(sync) FtpClient.FtpSocketStream(data)
[24/04/2025 13:55:47] [Info] > CloseDataStream()
[24/04/2025 13:55:48] [Verbose] Waiting for response to: NLST /In
[24/04/2025 13:55:48] [Info] Response: 226 Ok. [4,448s]
[24/04/2025 13:55:49] [Verbose] -----------------------------------------
[24/04/2025 13:55:50] [Verbose] Disposing(sync) FtpClient.FtpSocketStream(data) (redundant)
[24/04/2025 13:55:50] [Info] > OpenWrite("/In/GTT_20250421_135758_27942.EDI", Binary, -1, False)
[24/04/2025 13:55:51] [Info] > OpenDataStream("STOR /In/GTT_20250421_135758_27942.EDI", 0)
[24/04/2025 13:55:52] [Info] > OpenPassiveDataStream(PASV, "STOR /In/GTT_20250421_135758_27942.EDI", 0)
[24/04/2025 13:55:53] [Info] Command: PASV
[24/04/2025 13:55:53] [Verbose] Waiting for response to: PASV
[24/04/2025 13:55:54] [Info] Response: 227 (20,49,162,160,117,48) [642ms]
[24/04/2025 13:55:54] [Verbose] Connecting(sync) FtpClient.FtpSocketStream(data) IP #1 = ***:30000
[24/04/2025 13:55:55] [Info] Command: STOR /In/GTT_20250421_135758_27942.EDI
[24/04/2025 13:56:00] [Verbose] Waiting for response to: STOR /In/GTT_20250421_135758_27942.EDI
[24/04/2025 13:56:03] [Info] Response: 125 Data connection connected, starting transfer. [2,417s]
[24/04/2025 13:56:04] [Verbose] Uploaded 1024 bytes, FileExists("/In/GTT_20250421_135758_27942.EDI")
[24/04/2025 13:57:02] [Info] > GetNameListing("/In")
[24/04/2025 13:57:04] [Info] > OpenDataStream("NLST /In", 0)
[24/04/2025 13:57:05] [Info] > OpenPassiveDataStream(PASV, "NLST /In", 0)
[24/04/2025 13:57:06] [Info] Command: PASV
[24/04/2025 13:57:06] [Verbose] Waiting for response to: PASV
Подробнее здесь: https://stackoverflow.com/questions/795 ... same-error
Загрузка файла с помощью FluentFtp продолжает возвращать ту же ошибку ⇐ C#
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Может подключиться к FTP с помощью Filezilla или WinScp, но не с ftpwebRequest или fluentftp
Anonymous » » в форуме C# - 0 Ответы
- 25 Просмотры
-
Последнее сообщение Anonymous
-