从.Net调用SSIS包

时间:2009-10-26 21:25:49

标签: .net ssis

我从.Net Windows UI调用SSIS包。 SSIS和& .Net app是在2008年创建的.SSIS包存储在文件系统中。当我运行.Net应用程序时出错:

  

由于包装无法加载   错误0xC0011008“从中加载错误   XML。没有更详细的错误   可以为此指定信息   问题,因为没有Events对象   通过详细错误的地方   信息可以存储。“。这   在CPackage :: LoadFromXML时发生   失败。

异常细节 -

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(); 

请建议。

2 个答案:

答案 0 :(得分:3)

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

计算机2008上是否安装了SSIS版本?如果没有,它将无法运行 - 2005年和2008年的部件不可互换。

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

答案 1 :(得分:1)

在Lame loadPackage调用上获得完全相同的错误。

此代码适用于SQL 2005。

EnvDTE90看起来不像向DTS应用程序模型添加任何功能。

引用EnvDTE80和EnvDTE90不会产生任何差异