SSIS包在Visual Studio中运行良好,但在部署的框上手动运行时失败

boo*_*ick 6 sql-server ssis bids sql-server-2012

我有一个脚本任务,将某些传入的对象从一个服务器传输到另一个服务器.这是代码

public void Main()
        {
            try
            {
            string schemaName = Dts.Variables["$Package::SchemaName"].Value.ToString();
            string objectName = Dts.Variables["$Package::ObjectName"].Value.ToString();

            //object rawETLConnection = Dts.Connections["etl"].AcquireConnection(Dts.Transaction);
            //Server etlServer = (Server)rawETLConnection;

            Server etlServer = new Server("ciesqldeva04");
            Database etlDB;
            etlDB = etlServer.Databases["sell_side_content"];




            //object rawReportingConnection = Dts.Connections["reporting"].AcquireConnection(Dts.Transaction);
            //Server reportingServer = (Server)rawReportingConnection;
            Server reportingServer = new Server("ciesqldeva05");





                Transfer xfr;
                xfr = new Transfer(etlDB);
                xfr.DestinationServer = reportingServer.Name;
                xfr.DestinationDatabase = "sell_side_content";
                xfr.DropDestinationObjectsFirst = true;
                xfr.CopyAllObjects = false;
                xfr.CopyData = true;
                xfr.CopySchema = true;
                xfr.Options.DriAll = true;


                xfr.ObjectList.Add(etlDB.Tables[objectName, schemaName]);

                xfr.TransferData();
            }
            catch (SmoException smoex)
            {
                Dts.Events.FireError(120, " SMO - TransferObjects.dtsx", smoex.Message, "", 0);

            }
            catch (Exception ex)
            {
                Dts.Events.FireError(120,"Non SMO - TransferObjects.dtsx",ex.Message,"",0);

            } 
            Dts.TaskResult = (int)ScriptResults.Success;
        }
Run Code Online (Sandbox Code Playgroud)

当我通过Visual Studio 2012运行它时它工作正常.但是当我将它部署到盒子上并通过右键单击SSMS中的包名称并执行时运行它时,它会失败,并显示"使用SMO传输对象:错误:错误在传输数据时发生.有关详细信息,请参阅内部异常."

我还将脚本转换为控制台应用程序并在我之前部署包并通过终端运行它的盒子上运行它,它能够成功传输,因此它看起来不像丢失DLL的问题.

这是该控制台应用程序的代码

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using Microsoft.SqlServer.Dts.Runtime;
using Microsoft.SqlServer.Management.Smo;
using System.Collections.Specialized;
using System.Collections;
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Server etlServer = new Server("ciesqldeva04");
            Database etlDB;
            etlDB = etlServer.Databases["sell_side_content"];




            //object rawReportingConnection = Dts.Connections["reporting"].AcquireConnection(Dts.Transaction);
            //Server reportingServer = (Server)rawReportingConnection;
            Server reportingServer = new Server("ciesqldeva05");




            try
            {
                Transfer xfr;
                xfr = new Transfer(etlDB);
                xfr.DestinationServer = reportingServer.Name;
                xfr.DestinationDatabase = "sell_side_content";
                xfr.DropDestinationObjectsFirst = true;
                xfr.CopyAllObjects = false;
                xfr.CopyData = true;
                xfr.CopySchema = true;
                xfr.Options.DriAll = true;


                xfr.ObjectList.Add(etlDB.Tables["award_sector", "people"]);

                xfr.TransferData();
            }
            catch (SmoException smoex)
            {
                Console.WriteLine("This is an SMO Exception");
                //Display the SMO exception message. 
                Console.WriteLine(smoex.Message);
                //Display the sequence of non-SMO exceptions that caused the SMO exception. 
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

我尝试了各种各样的事情但没有成功.任何帮助将非常感激.

PS我在SQL Server 2012上运行它.