"脚本来源"验证失败并返回验证状态" VS_ISBROKEN"

时间:2018-04-25 16:44:37

标签: ssis

我们有一个预定的工作,每天执行一个SSIS包,它一直工作正常。但最近对于一个客户来说,它失败并出现以下错误,并且在没有任何修复相同数据源文件的情况下再次正常工作。对于不同的数据源文件也会出现同样的问题,但这种问题并不一致。

以下是程序包失败时的日志详细信息。对于数据流任务,我们将DelayValidation设置为True。有人可以帮我解决这个问题吗?

日志文件中的详细信息:

04/20/2018 2:00:08 PM: About to execute the package
04/20/2018 2:00:08 PM: Execute result: Failure
04/20/2018 2:00:08 PM: Executing the package resulted in 4 error(s)
04/20/2018 2:00:08 PM: Error: The binary code for the script is not found. Please open the script in the designer by clicking Edit Script button and make sure it builds successfully.
04/20/2018 2:00:08 PM: Microsoft.SqlServer.Dts.Runtime.DtsError
04/20/2018 2:00:08 PM: Error: "Script Source" failed validation and returned validation status "VS_ISBROKEN".

04/20/2018 2:00:08 PM: Microsoft.SqlServer.Dts.Runtime.DtsError
04/20/2018 2:00:08 PM: Error: One or more component failed validation.

04/20/2018 2:00:08 PM: Microsoft.SqlServer.Dts.Runtime.DtsError
04/20/2018 2:00:08 PM: Error: There were errors during task validation.

04/20/2018 2:00:08 PM: Microsoft.SqlServer.Dts.Runtime.DtsError

抛出错误的代码:

private void RecompileScriptSource()         {             IDTSComponentMetaData100 srcComp = m_Pipeline.ComponentMetaDataCollection [BASE_SCRIPT_SOURCE_COMPONENT];

        // Get design time instance of script source
        CManagedComponentWrapper scriptSourceWrapper = srcComp.Instantiate();

        // Get script host & save
        try
        {
            ScriptComponentHost host = (scriptSourceWrapper as IDTSManagedComponent100).InnerObject as ScriptComponentHost;
            if (host == null)
            {
                throw new Exception("Failed to get access to the host object for the script component.");
            }

            if (!host.LoadScriptFromComponent()) // This returns false
            {
                throw new Exception("Failed to load script information from component.");
            }
            VSTAComponentScriptingEngine engine = host.CurrentScriptingEngine;

            if (engine.VstaHelper == null)
            {
                throw new Exception("Vsta 3.0 is not installed properly");
            }

            if (!engine.LoadProjectFromStorage()) // This returns false
            {
                throw new Exception("Failed to load project files from storage object");
            }

            if (!host.SaveScriptProject())
            {
                log("Failed to save script project");
            }
            else
            {
                log("Saved script project");
            }

            engine.DisposeVstaHelper();
        }
        finally
        {
            log("Finished saving (or compiling or whatever");
        }

        // Validate script source
        DTSValidationStatus stat = scriptSourceWrapper.Validate();
        switch (stat)
        {
            case DTSValidationStatus.VS_ISBROKEN:
                log("Script source validation result says BROKEN");
                break;
            case DTSValidationStatus.VS_ISCORRUPT:
                log("Script source validation result says CORRUPT");
                break;
            case DTSValidationStatus.VS_ISVALID:
                log("Script source validation result says VALID");
                break;
            case DTSValidationStatus.VS_NEEDSNEWMETADATA:
                log("Script source validation result says NEED NEW METADATA");
                break;
        }
    }

0 个答案:

没有答案