Я пытаюсь загрузить файл, используя 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 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)
Подробнее здесь: https://stackoverflow.com/questions/795 ... same-error
Загрузка файла с помощью FluentFtp продолжает возвращать ту же ошибку ⇐ C#
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Может подключиться к FTP с помощью Filezilla или WinScp, но не с ftpwebRequest или fluentftp
Anonymous » » в форуме C# - 0 Ответы
- 25 Просмотры
-
Последнее сообщение Anonymous
-