Hello. I have several C# programs using the WinSCP DLL. Each of the C# programs is compiled as a console app and run as a simple .exe file, which is later kicked off by an SQL Server job.
I recently coded a new program that uses ftp. All the others use SFTP. See below C# code.
I added some debug code to the c# program and it looks like it opens the session fine, but when it hits transferResult.Check(), I get this error:
Error listing directory '/Export_UAT'.
Transfer channel can't be opened. Reason: No connection could be made because the target machine actively refused it.
Could not retrieve directory listing
I've also contacted the people I'm trying to connect to and they tell me they don't manage IP addresses on their end.
Also when I run this on my own PC as an exe, it works fine. When it's run on the server it gives the error listed above. All the other WinSCP programs work fine. The only difference being this is a different vendor, and it's FTP, not SFTP. Any help would be great. Thanks
SessionOptions sessionOptions = new SessionOptions
Protocol = Protocol.Ftp,
HostName = "HostName.com",
UserName = "MyUserName",
Password = "password123",
FtpSecure = FtpSecure.Implicit,
TlsHostCertificateFingerprint = "blah.....",
TransferOptions transferOptions = new TransferOptions();
transferOptions.TransferMode = TransferMode.Binary;
transferResult = session.GetFiles(SFTPFolder, MyDownLoadFolder, false, transferOptions);
foreach (TransferEventArgs transfer in transferResult.Transfers)