我正在尝试通过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);
}
}