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

Here is my code

try
            {
                //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!

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.