0

我正在尝试通过 Windows 服务加载和执行 SSIS 包。如果我使用命令提示符手动运行它,它工作得很好。但是,如果我尝试使用 Windows 服务,它每次都会失败。

private void PackageExecute()
    {
        try
        {
            TraceService("Another entry at " + DateTime.Now);
            //Instansiate an DTS RunTime Application Object
            Application app = new Application();
            TraceService("loading system From File system");
            //Create package Container to hold the package.
            //And Load the Package Using the Application Object.
            Package package = app.LoadPackage(@"C:\Users\kavita.verma\Documents\Visual Studio 2012\Projects\WindowsServiceTest\WindowsServiceTest\Package1.dtsx", null);

            TraceService("Execution Started");
            DTSExecResult result = package.Execute();
            // print the result
            TraceService(result.ToString());
            TraceService("Execution Completed");
        }
        catch (Exception ex)
        {
            TraceService("Execution Error" + ex);
        }

    }
4

0 回答 0