winscp-net

WinSCP .NET assembly: Where to define proxy?

天大地大妈咪最大 提交于 2019-11-30 13:49:00
I am able to define the proxy server by using the WinSCP GUI. If I do this I am able to connect to a remote host. But in code I don't find a way to declare the proxy server for WinSCP. In this case I receive Remote server returned an error (407) Proxy authentication required. My code: SessionOptions sessionOptions = new SessionOptions { Protocol = protocol, HostName = hostname, UserName = user, Password = pass, PortNumber = portnumber }; using (Session session = new Session()) { session.ExecutablePath = @"C:\Program Files (x86)\WinSCP\WinSCP.exe"; session.Open(sessionOptions); TransferOptions

SSIS C# 2012 Script Task referring WinSCPnet.dll fails when run from SQL Server Agent with “Exception has been thrown by the target of an invocation”

戏子无情 提交于 2019-11-29 11:13:33
I have an SSIS package (created in VS 2013) that contains a C# 2012 Script Task. The job of the script task is to download a file from an SFTP server using WinSCP .NET assembly and place it on my server (Windows Server 2012 R2 with SQL Server 2014) My package runs fine when I run it on my Dev machine, but when I deploy to the server my package fails at this task with the error message Exception has been thrown by the target of an invocation I've done some digging and it looks like it has something to do with the reference to WinSCPnet.dll . Quoting WinSCP article on Exception has been thrown