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