0

I have this weird problem with my SSIS package, it works fine in BIDS, works fine as a SQL Agent Job, but as soon as I run in within my winform using Package.LoadPackage, the Back Up DataBase Task magically failed. I put a data flow task before and after the back up task to see if the package was excuted at all and it did, the first data flow task was executed successfully however it stops when trying to back up the database. I have add users to Local DCOM Group and I have given permissions to the user under security tab in MsDtsServer100, but nothing helps. Does any1 know what could cause the problem? btw. no error messages were given at any time during this process.

In my winform i have

string pkgLocation;
Package pkg;
Microsoft.SqlServer.Dts.Runtime.Application app;
DTSExecResult pkgResults;

pkgLocation = @"C:\Integration Services Project1\obj\Development\Package.dtsx";

app = new Microsoft.SqlServer.Dts.Runtime.Application();

pkg = app.LoadPackage(pkgLocation, null);

pkgResults = pkg.Execute();

foreach (DtsWarning w in pkg.Warnings)
{
MessageBox.Show(w.Description);
}

MessageBox.Show(pkgResults.ToString());

Thank you guys, any suggestion would be appreciated.

praveen
  • 12,083
  • 1
  • 41
  • 49
Mike Zhang
  • 62
  • 8
  • anything in the event logs ? – V4Vendetta May 08 '13 at 06:07
  • is your Winform application running in the `same context` as the SSIS package ? Have u enabled logging in SSIS – praveen May 08 '13 at 06:15
  • Hello guys, thanks for your fast reply. Yes, the winform app is running on the same machine where the SSIS package is located. The wierd part is that no error is shown neither in event log nor MS server log. o.O – Mike Zhang May 08 '13 at 06:23

1 Answers1

0

All right guys, I got this one fixed. The solution is simple, so simple that I want to stab myself with a keyboard.

Solution

In your winform, go to app.config and add this holy line:

<startup useLegacyV2RuntimeActivationPolicy="true">
JleruOHeP
  • 10,106
  • 3
  • 45
  • 71
Mike Zhang
  • 62
  • 8