I am having a problem running an ssis package from a service written in C#.

Here is my code

                //Package Path
                string packagePath = @"C:\\data_from_listcleanup\\programmability\\Package.dtsx";

                //create an instance of the package
                Package goPackage = new Application().LoadPackage(packagePath, null);

                //execute package
                DTSExecResult result = goPackage.Execute();

                //write results to file
                m_streamWriter.WriteLine("Package Execution Results: {0} \n", result.ToString());

            catch (Exception ex)
                m_streamWriter.WriteLine("Error from dts: {0} \n", ex.ToString());

it does not go to Exception it just fails.

The txt file just says it fails.

I can run the package on my own and it runs fine so the package is good. This is my first time writing a call to an ssis package from code so I may be doing it completely wrong...

Thanks in advance!

8 Years
Discussion Span
Last Post by Yellowdog428

Well its really strange, so the code above works fine from a form application but from a service it does not..... same code differant beast so my next question is...

Does anyone know what would make a piece of code not work from a service that will work in a form application?

Thanks in advance

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.