we are facing an issue when running an SSIS package from ASP.NET when the web site is deployed. We have the package loaded in an Integration Services server in MSDB. When we try the package from SQL Server Management Studio, it runs properly. When I execute the code from my Visual Studio, the package loaded in the server runs properly. The issue comes when the page is deployed to a server: There are no exceptions caught and no errors logged, but the package does not execute. We just see an error in Windows Event Viewer saying: "Package "" failed.". The ASP.NET page runs impersonation of an account with "sysadmin" access to the SQL Server and also the shares where the source Excel files are.
Here is the code calling the SSIS package:
public void executePkg(string pkgAddr, string pkgServer, int periodID)
{
logger.Info(string.Format("Execution of SSIS Package '{0}' in server '{1}' started.", pkgAddr, pkgServer));
string pidvar = "User::periodid";
string pkgLocation;
Package pkg;
Application app;
DTSExecResult pkgResults;
app = new Application();
pkgLocation = pkgAddr;
try
{
pkg = (Package)app.LoadFromSqlServer(pkgAddr, pkgServer, null, null, null);
Variables vars = pkg.Variables;
int varCount = vars.Count;
bool varExist = vars.Contains(pidvar);
pkg.VariableDispenser.LockOneForWrite(pidvar, ref vars);
vars[pidvar].Value = periodID;
pkg.Variables[pidvar].Value = periodID;
vars.Unlock();
pkgResults = pkg.Execute();
}
catch (Exception ex)
{
logger.Error(ex.Message);
}
}
Any help would be appreciated.
Note: Just a small correction, the ASP.NET is no longer impersonating, instead, the AppPool is running with the service account. The behavior is the same with both scenarios.