.net - 从.Net调用SSIS包

标签 .net ssis

我正在从 .Net windows UI 调用 SSIS 包。 SSIS 和 .Net 应用程序均创建于 2008 年。SSIS 包存储在文件系统中。当我运行 .Net 应用程序时,出现错误:

The package failed to load due to error 0xC0011008 "Error loading from XML. No further detailed error information can be specified for this problem because no Events object was passed where detailed error information can be stored.". This occurs when CPackage::LoadFromXML fails.

异常详细信息 -

Microsoft.SqlServer.Dts.Runtime.DtsRuntimeException was unhandled
  HelpLink="#-1073659847"
  Message="The package failed to load due to error 0xC0011008 \"Error loading from XML. No further detailed error information can be specified for this problem because no Events object was passed where detailed error information can be stored.\". This occurs when CPackage::LoadFromXML fails.\r\n"
  Source=""
  ErrorCode=-1073672184
  StackTrace:
       at Microsoft.SqlServer.Dts.Runtime.Application.LoadPackage(String fileName, IDTSEvents events, Boolean loadNeutral)
       at SSISCall.Form1.Execute_Click(Object sender, EventArgs e) in D:\SSISCall\SSISCall\Form1.cs:line 36
       at System.Windows.Forms.Control.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ButtonBase.WndProc(Message& m)
       at System.Windows.Forms.Button.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at SSISCall.Program.Main() in D:\SSISCall\SSISCall\Program.cs:line 17
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: System.Runtime.InteropServices.COMException
       HelpLink="#-1073659847"
       Message="The package failed to load due to error 0xC0011008 \"Error loading from XML. No further detailed error information can be specified for this problem because no Events object was passed where detailed error information can be stored.\". This occurs when CPackage::LoadFromXML fails.\r\n"
       Source=""
       ErrorCode=-1073672184
       StackTrace:
            at Microsoft.SqlServer.Dts.Runtime.Wrapper.ApplicationClass.LoadPackage(String FileName, Boolean loadNeutral, IDTSEvents90 pEvents)
            at Microsoft.SqlServer.Dts.Runtime.Application.LoadPackage(String fileName, IDTSEvents events, Boolean loadNeutral)
       InnerException: 

我使用的代码非常简单:

string packageLocation;
Package ssisPackage;
Microsoft.SqlServer.Dts.Runtime.
Application ssisApplication;
DTSExecResult ssisPackageResult;
packageLocation =@"D:\SSISCall\Package.dtsx";
ssisApplication =new Microsoft.SqlServer.Dts.Runtime.Application();
ssisPackage = ssisApplication.LoadPackage(packageLocation,null); ----Getting error here
ssisPackageResult = ssisPackage.Execute();
Console.WriteLine(ssisPackageResult.ToString());
Console.ReadKey(); 

请提出建议。

最佳答案

您执行此包的计算机上是否安装了 SSIS 组件?如果没有,它将无法运行 - 请参阅 http://msdn.microsoft.com/en-us/library/ms403348.aspx

计算机上安装的SSIS版本是2008吗?否则,它将无法运行 - 2005 和 2008 部件不可互换。

驱动器“D”是映射驱动器吗?如果是这样,您的代码可能无法在无人值守的情况下运行(使用未登录的用户 session ) - 请改用 UNC 路径。

关于.net - 从.Net调用SSIS包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1627422/

相关文章:

sql-server - 如何将SSIS包部署到Azure?

sql-server-2005 - 需要更智能的环境包配置

c# - ssis 脚本任务添加数百列的输出

c# - 优化对绑定(bind)到 DataGridView 的 DataTable 的更新

c# - Environment.Exit() 和 Application.Shutdown() 有什么区别?

sql - 将参数从 Access 中的另一个查询传递给查询

SSIS 表达式设置两个变量

c# - 设置项目权限

c# - Microsoft.Web.Administration 内存泄漏

database - 使用SSIS整合两个数据库之间的数据