Exception has been thrown by the target of an invocation

This is just a high-level exception. The root cause is usually stored in the InnerException.

If you are getting this exception in SSIS, you can use trycatch block to capture the error, as show in the example for using WinSCP .NET Assembly from SSIS. Though this won’t help if the error occurs even before the SSIS Main method is started. In this case, the actual error should be shown on the Progress tab of your SSIS package. Often, the root cause can be loading of WinSCPnet.dll assembly. See Could not load file or assembly ‘file:///…\WinSCPnet.dll’ or one of its dependencies. The system cannot find the file specified.

Advertisement

If you do not use SSIS and you cannot access the inner exception easily, inspect WinSCP session log and debug log file (Session.SessionLogPath, Session.DebugLogPath).

Last modified: by martin – Currently locked by: 196.51.35.110