Topic "Dir Sync: WinSCP.SessionRemoteException for remote path"

Author Message
sebastian.hockmann
[View user's profile]

Joined: 2014-04-25
Posts: 1
Location: Deutschland
Hello.

i would like to mirror / sync a FTP directory to a local path.
I'm using the current version of the .NET library.

This works fine on my developer machine. But on the production machine
i get the following error:

WinSCP.SessionRemoteException: Error retrieving file list for "\\group.jenoptik.corp\Global\OS\OES\PS\Triptis\Files\PRODUKTION\AVT\Projekte\CMOSIS\01_ARF\

I can access this path on the production machine.

I attached the logs (debug+session)

Any ideas for the root cause ?

Thanks,
Sebastian

P.D:


Here is my C# coding:

public class FTPSync
{
public int syncronizeDirectory( string hostname, string username, string password, string localpath, string remotepath)
{

//set connection parameters
WinSCP.SessionOptions sessionOptions = new SessionOptions();
sessionOptions.Protocol = WinSCP.Protocol.Ftp;
sessionOptions.HostName = hostname; //"as-ftp-e01.jenoptik.corp";
sessionOptions.UserName = username; //"JOPS-CMOSIS";
sessionOptions.Password = password; //"1234";
sessionOptions.FtpMode = FtpMode.Passive;

//

WinSCP.Session session = new Session();
session.DebugLogPath = @"d:\debuglog.txt";
session.SessionLogPath = @"d:\sessionlog.txt";
session.

try
{

using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"d:\auth.txt"))
{
string svc_username = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
file.WriteLine(svc_username);
}

//change user context
using (new Impersonator ("service.wmistest","CORP","1234"))
{

//log user context
using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"d:\auth.txt"))
{
string svc_username = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
file.WriteLine(svc_username);
}

session.FileTransferred += FileTransferred;
// Connect
session.Open(sessionOptions);

string localpath = @"\\group.jenoptik.corp\Global\OS\OES\PS\Triptis\Files\PRODUKTION\AVT\Projekte\CMOSIS\01_ARF";
string remotepath = "01_ARF";

// Synchronize files to local directory, collect results
SynchronizationResult synchronizationResult;
synchronizationResult =
session.SynchronizeDirectories(
WinSCP.SynchronizationMode.Local, localpath, remotepath, false);

//throw on any error
synchronizationResult.Check();

return 0;

}
}




catch (Exception e)
{
Console.WriteLine("Error: {0}", e);
using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"d:\error.txt"))
{
file.WriteLine(e);
}

//errormessage = e.Message;
return -1;
}

}

private static void FileTransferred(object sender, TransferEventArgs e)
{
if (e.Error == null)
{
Console.WriteLine("Upload of {0} succeeded", e.FileName);
}
else
{
Console.WriteLine("Upload of {0} failed: {1}", e.FileName, e.Error);
}

if (e.Chmod != null)
{
if (e.Chmod.Error == null)
{
Console.WriteLine("Permisions of {0} set to {1}", e.Chmod.FileName, e.Chmod.FilePermissions);
}
else
{
Console.WriteLine("Setting permissions of {0} failed: {1}", e.Chmod.FileName, e.Chmod.Error);
}
}
else
{
Console.WriteLine("Permissions of {0} kept with their defaults", e.Destination);
}

if (e.Touch != null)
{
if (e.Touch.Error == null)
{
Console.WriteLine("Timestamp of {0} set to {1}", e.Touch.FileName, e.Touch.LastWriteTime);
}
else
{
Console.WriteLine("Setting timestamp of {0} failed: {1}", e.Touch.FileName, e.Touch.Error);
}
}
else
{
// This should never happen with Session.SynchronizeDirectories
Console.WriteLine("Timestamp of {0} kept with its default (current time)", e.Destination);
}
}
}
}
sessionlog.txt (6.13 KB) [Download]

Description: (none)

debuglog.txt (39.4 KB) [Download]

Description: (none)

martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25025
Location: Prague, Czechia
sebastian.hockmann wrote:
I can access this path on the production machine.

Can you access it even as CORP\AS-ESB-01T$?
_________________
Martin Prikryl
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License