DTS脚本任务运行时错误:调用目标已引发异常 [英] DTS Script Task Runtime Error: Exception has been thrown by the target of an invocation

查看:291
本文介绍了DTS脚本任务运行时错误:调用目标已引发异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have a ssis project developed in vs 2012 Ultimate. I use project deployment model and the project is set to run in 32 bit mode. The package executes without error in my development environment but when I deploy it to the ssis catalog and attempt to run it there, I get the following error:

我将该项目部署到Windows Server 2012 R2,并且该数据库也是2012年,带有SSIS目录。

I deploy the project to a Windows Server 2012 R2 and the database is also 2012 with an SSIS catalog.

我已经在服务器上打开了项目,并尝试在服务器上调试带有断点的脚本任务,但错误

I have opened the project on the server and attempted to debug the script task on the server with a break point but the error occurs prior to getting to the break point.

如果禁用所有脚本任务,程序包将在服务器上执行而不会出错。

If I disable all of my script tasks, the package executes without error on the server.

我还通过禁用系统密码术:使用FIPS兼容算法作为服务器上 Microsoft支持

I have also updated the servers local security options by disabling System Cryptography: Use FIPS Compliant Algorithms as a possible solution posted on Microsoft Support.

我也试图以文件形式运行服务器上的系统软件包,并且出现相同的错误。

I have also attempted to run as a file system package on the server and I get the same error.

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

I have also triple checked that my variables are correct and even set them as read write variables.

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

The first script task code is below (but all scrip tasks fail / three in this package). The script task references a dll called UHS.IntegrationServices.CommonUtils that has been GACed and the dll was built in VS 2005 with framwork 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中查看它。

The problem appears to be in the reference to the dll. When I comment out the NotifyInterface and NotifyListener lines the script executes without error but the dll is in the GAC and I can view it in C:\Windows\assembly.

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

Why would this work on my local but not the Server? Is the 2.0 framework needed on the server? If the reference to the dll is broken, shouldn't I get a more descriptive error?

在寻求解决问题思路方面的任何帮助将不胜感激。

Any assistance in finding trouble shooting ideas would be greatly appreciated.

推荐答案

您需要在FIRST脚本任务的开始处设置一个断点,就像在任何VB调试情况下一样。然后按F8键浏览每一行代码,直到引发错误为止。

You need to set a breakpoint at the beginning of the FIRST script task, just as you would do in any VB debugging situation. Then F8 through each line of code until an error is thrown.

这篇关于DTS脚本任务运行时错误:调用目标已引发异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆