Executing SSIS FROM c#

I have an ssis package that uses a dtscofing file it imports data from a csv file to a sql server table. It works fine when run from Business Intelligence studio. When I call it from C# it fails. I have spend hours debug this code and no progress. Here sample code:

Configuration.ProductConfiguration config = new ProductConfiguration();
                Microsoft.SqlServer.Dts.Runtime.Application app = new Microsoft.SqlServer.Dts.Runtime.Application();
                Package package = app.LoadPackage(ProductConfiguration.UpdateSkuSSIS, null);
                package.ImportConfigurationFile(ProductConfiguration.UpdateSkuConfigFile);
                DTSExecResult result = package.Execute();

Please help!!!
bitolexusAsked:
Who is Participating?
 
illConnect With a Mentor Commented:
Log file suggest, that SQL server editions are not the same. BI studio is probably using SQL developer edition ( basically same as enterprise), but production server runs other( SQL standard perhaps? ).
Functionality that is included in BI studio is missing on server.
Run 'select @@version' to check for status.
0
 
carsRSTCommented:
See this link.  It will walk you step by step.  

http://www.codeproject.com/KB/database/CallSSISFromCSharp.aspx
0
 
PedroCGDCommented:
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

 
bitolexusAuthor Commented:
My code is doing something similar. My dtsConfig and dtsx locations are coming from the app.config. I exported all user variables into the dtsconfig. I am assuming they should be automatically loaded . Its really annoying BI studio execute the same package without problem. One I should let you know is that I renamed the package but I don't think that is an issue.
0
 
carsRSTCommented:
If you take out the config file and hard code the variables in, does it work?
0
 
carsRSTCommented:
Are you passing in variables from c# or reading from within SSIS?
0
 
bitolexusAuthor Commented:
There are 3 variables which hold path for csv loaction, archive folder and error folder. the value are in ssis. my package has a dtsconfig which holds the same values. I am passing dtsx file location and dtsconfig file location from C#. I have tried to invoke validate method of the Package before invoking execute and it returns success.
0
 
carsRSTCommented:
Is there error in c# or in SSIS?  Do you have an SSIS error log you can post?
0
 
bitolexusAuthor Commented:
no error in ssis, c# returns enum DTSExecResult.Failure
0
 
carsRSTCommented:
Your best bet is to set logging and see exactly what is happening when you run via c#.
http://msdn.microsoft.com/en-us/library/ms141212.aspx

If you can post the log, then Pedro and I may be able to assist what the issue is.
0
 
bitolexusAuthor Commented:
Here is my log file
log.txt
0
 
carsRSTCommented:
It looks as if you need to install all of SSIS on the work station running your c# code.  My guess is you do that install and your package should run fine from your app.
0
 
bitolexusAuthor Commented:
u r correct
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.