Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
SSIS脚本组件运行时错误_Ssis - Fatal编程技术网

SSIS脚本组件运行时错误

SSIS脚本组件运行时错误,ssis,Ssis,我在运行包时遇到了一个有效问题。它在我的电脑上运行失败,在其他任何电脑上运行成功。 该错误是由脚本组件(变为红色)引起的,它处于后执行阶段,不是脚本组件中的后执行阶段,而是在包的运行时。错误是: Information: 0x40043008 at Data Flow Task, SSIS.Pipeline: Post Execute phase is beginning. Error: 0xC0047062 at Data Flow Task, Script Component [263]:

我在运行包时遇到了一个有效问题。它在我的电脑上运行失败,在其他任何电脑上运行成功。 该错误是由脚本组件(变为红色)引起的,它处于后执行阶段,不是脚本组件中的后执行阶段,而是在包的运行时。错误是:

Information: 0x40043008 at Data Flow Task, SSIS.Pipeline: Post Execute phase is beginning.
Error: 0xC0047062 at Data Flow Task, Script Component [263]: System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.SqlServer.Dts.Runtime.Wrapper.IDTSVariables100'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{22992C1D-393D-48FB-9A9F-4E4C62441CCA}' failed due to the following error: The application called an interface that was marshalled for a different thread. (Exception from HRESULT: 0x8001010E (RPC_E_WRONG_THREAD)).

我猜问题与变量有关,因为当我删除所有与变量相关的代码时,包会成功运行。脚本组件中的代码:

private int scheduled550;
private int scheduled620;
private int scheduled720;
private int scheduled820;
public override void PreExecute()
{

    base.PreExecute();
    scheduled550 = Variables.Count550;
    scheduled620 = Variables.Count620;
    scheduled720 = Variables.Count720;
    scheduled820 = Variables.Count820;

}

public override void PostExecute()
{
    base.PostExecute();

}
有没有人遇到过同样的问题?谁能告诉我后执行阶段会做什么?谢谢


更多信息:我已尝试重新安装SQL Server,但这没有帮助。并且,并非所有在my SSI中运行变量失败的脚本组件(与错误组件不在同一个包中)

SSI中的所有任务/容器都具有相同的生命周期。你可以通过观察火灾来了解其中的一些情况。在脚本组件中,在数据流任务中,将执行各种步骤。其中一部分是验证(该合同规定我应该从该表中获得一个整数类型的列-我可以连接吗,它是否存在,它是否是正确的类型,等等)

验证后,任务将有设置和拆卸步骤要执行。由于您似乎在脚本中使用SSIS变量,部分执行前/执行后时间用于将变量(SSIS)转换为变量(.net)并再次转换

在看到导致失败的PostExecute方法中的特定代码之前,我无法说明代码问题可能是什么

我无法重现你的问题。虽然这是2012版的Integration Services,但您正在使用的脚本组件的行为将与此相同。我没有将输出发送到Excel,但考虑到脚本失败,这不重要

我的脚本组件。在编辑代码之前,我在菜单中选择了变量User::Count550作为只读变量

public class ScriptMain : UserComponent
{
    private int scheduled550;

    public override void PreExecute()
    {
        base.PreExecute();
        this.scheduled550 = Variables.Count550;
    }

    public override void PostExecute()
    {
        base.PostExecute();
        //this.Variables.Count550 = scheduled550;
        //this.VariableDispenser.LockForWrite("Count550");
    }

    public override void Input0_ProcessInputRow(Input0Buffer Row)
    {
        if (true)
        {
            this.scheduled550++;
        }
    }

}

那么,导致数据流失败的PostExecute中的代码是什么呢?问题是:Microsoft.SqlServer.Dts.Runtime.Wrapper.IDTSVariables100.Unlock()位于Microsoft.SqlServer.Dts.Pipeline.ScriptComponent.UnlockReadOnlyVariables()位于Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.PostExecute();但是我的PostExecute中没有任何代码,似乎它在后台。所以这是你脚本任务中唯一的东西?您在
Input0\u ProcessInputRow
方法中什么都不做?您现在处于(发布到制造)状态,已经3年了,49个公共补丁已经过期。我强烈怀疑这个问题将与此相关,但请随时检查工作机器的版本。即使不是这样,从那时到现在,你真的很想修补这么多的bug。我真的很感谢你的帮助,但正如我所说,这个问题只是出现在我的电脑上,不能在任何其他人的电脑上重现,所以你认为有没有任何配置/注册表可以影响这一点