【问题标题】:Renci.SshNet not working in SSIS 2016 script taskRenci.SshNet 在 SSIS 2016 脚本任务中不起作用
【发布时间】:2016-06-24 02:00:21
【问题描述】:

将 SQL Server 2016 (13.0.15000.23) 和 SSIS 与带有最新 SSDT 的 VS 2015 社区一起使用 我有一个带有 1 个脚本任务的简单 SSIS 测试包。 在该任务中,我只是添加了对 Renci.sshnet (2014.4.6.0) 的引用,它是一个 .NET 4.0 DLL。
我将项目目标框架更改为 4.0 可以进行基本调用以创建连接:

Console.WriteLine("Start");

Renci.SshNet.ConnectionInfo ConnNfo = new   
Renci.SshNet.ConnectionInfo("hostOrIP", 22, "username",
       new AuthenticationMethod[]{

            // Pasword based Authentication
            new PasswordAuthenticationMethod("username","password"),

            // Key Based Authentication (using keys in OpenSSH Format)
            new PrivateKeyAuthenticationMethod("username",new PrivateKeyFile[]{
                new PrivateKeyFile(@"..\openssh.key","passphrase")
            }),
       }
   );

当我立即运行它时,会得到一个 DTS 脚本任务:运行时错误 “调用的目标已抛出异常。”

我已经获取了代码并从中制作了一个独立的控制台应用程序。即使是 4.5,它也运行良好。

这整个事情在具有 Sql Server 2008R2 的旧服务器中使用完全相同的代码运行良好

我在新配置中遗漏了一些东西。每当我引用和使用 renci.sshnet 时它都不会运行

我也尝试在 writeline 上设置一个断点,但它没有让我到达那里..在我到达它之前它失败了..

有什么想法吗?我没有选择。

提前致谢。

-肯

【问题讨论】:

    标签: ssis sql-server-2016 ssh.net


    【解决方案1】:

    显然您必须将任何引用的 DLL 添加到 GAC !!!是的..忘记了..这修复了它...仅通过 VS 命令提示符的管理员运行..

       D:\Flint\References>gacutil /i Renci.SshNet.dll
       Microsoft (R) .NET Global Assembly Cache Utility.  Version 4.0.30319.0
       Copyright (c) Microsoft Corporation.  All rights reserved.
    
       Assembly successfully added to the cache
    

    以此为参考... http://microsoft-ssis.blogspot.ru/2011/05/referencing-custom-assembly-inside.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-25
      • 1970-01-01
      • 2014-06-03
      相关资源
      最近更新 更多