【问题标题】:DTS Script Task Runtime Error: Exception has been thrown by the target of an invocationDTS 脚本任务运行时错误:调用目标已引发异常
【发布时间】:2014-07-08 22:38:19
【问题描述】:

我有一个在 vs 2012 Ultimate 中开发的 ssis 项目。我使用项目部署模型,项目设置为在 32 位模式下运行。该包在我的开发环境中执行没有错误,但是当我将它部署到 ssis 目录并尝试在那里运行它时,我收到以下错误:

我将项目部署到 Windows Server 2012 R2,数据库也是 2012 的 SSIS 目录。

我已在服务器上打开项目,并尝试在服务器上调试脚本任务,但在到达断点之前发生错误。

如果我禁用所有脚本任务,包在服务器上执行时不会出错。

我还通过禁用 System Cryptography: Use FIPS Compliant Algorithms 更新了服务器本地安全选项,作为Microsoft Support 上发布的可能解决方案。

我也尝试在服务器上作为文件系统包运行,但我得到了同样的错误。

我还三次检查了我的变量是否正确,甚至将它们设置为读写变量。

第一个脚本任务代码如下(但所有脚本任务都失败/此包中的三个)。脚本任务引用了一个名为 UHS.IntegrationServices.CommonUtils 的 dll,该 dll 已被 GACed 并且该 dll 是在 VS 2005 中构建的,框架为 2.0.50727。

Public Sub Main()

    Dim packageID As String = Dts.Variables("System::PackageID").Value.ToString()
    Dim strInterfaceName As String = Dts.Variables("System::PackageName").Value.ToString()
    Dim strConfigConnectionString1 As String = Dts.Variables("User::UHS_SSIS_CNXN_STR_CONFIG").Value.ToString()
    Dim myConnection As OleDb.OleDbConnection = New OleDb.OleDbConnection
    Dim mySqlCommand As OleDb.OleDbCommand = New OleDb.OleDbCommand
    Dim myReader As OleDb.OleDbDataReader = Nothing
    Dim rowsProcessed As Integer = 0

    Try
        myConnection.ConnectionString = strConfigConnectionString1
        myConnection.Open()

        Dim getEmailQuery As String = "SELECT Email FROM EmailMaster" & _
                                      " where InterfaceName='" & strInterfaceName & "'" & _
                                      " and Active = 'Y' "

        Dim NotifyInterface As SMTPNotifyAlerts
        NotifyListenerManager.GetNotifierByType(packageID, NotifyInterface, CommonNotifierAlerts.AlertInfo.AlertTypes.alertEmail)


        mySqlCommand = New OleDb.OleDbCommand(getEmailQuery, myConnection)
        mySqlCommand.CommandTimeout = 0
        myReader = mySqlCommand.ExecuteReader

        If (myReader.HasRows()) Then
            While (myReader.Read())
                NotifyInterface.alertDest.Add(myReader("Email").ToString().Trim())
                rowsProcessed = rowsProcessed + 1
            End While
        End If

        NotifyListenerManager.BroadcastMessage(CommonNotifierAlerts.BasicAlerts, 0, Nothing, "Startup logfile")
        Dts.TaskResult = ScriptResults.Success
    Catch ex As Exception
        Dts.Events.FireError(0, "Init Email Master", ex.Message, "", 0)
        Dts.TaskResult = ScriptResults.Failure
    End Try

End Sub

问题似乎在于对 dll 的引用。当我注释掉 NotifyInterface 和 NotifyListener 行时,脚本执行没有错误,但 dll 在 GAC 中,我可以在 C:\Windows\assembly 中查看它。

为什么这可以在我的本地而不是服务器上工作?服务器上需要2.0框架吗?如果对 dll 的引用被破坏,我不应该得到一个更具描述性的错误吗?

我们将不胜感激在寻找故障排除想法方面的任何帮助。

【问题讨论】:

  • 您好,您的问题解决了吗?有什么解决办法?谢谢

标签: .net vb.net visual-studio-2012 ssis


【解决方案1】:

您需要在 FIRST 脚本任务的开头设置断点,就像在任何 VB 调试情况下一样。然后 F8 遍历每一行代码,直到抛出错误。

【讨论】:

    【解决方案2】:

    我的问题解决了。 “我们遇到的问题是我们对分析管理对象的 .net 引用是 11.0 (2012),它必须是 12.0 (2014)。”

    链接:https://mitchellpearson.com/2015/04/13/upgrading-script-tasks-in-ssis-target-of-invocation-on-script-task/

    【讨论】:

      【解决方案3】:

      我发现问题是我刚刚添加的一个参考,但尚未在 GAC 中注册。我运行了“AddToGAC.bat”例程,然后任务成功运行。

      【讨论】:

        猜你喜欢
        • 2018-09-20
        • 2015-05-13
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-02-25
        • 1970-01-01
        相关资源
        最近更新 更多