尝试以编程方式执行 SSIS 包时找不到 SSISDB 目录
Cannot find SSISDB Catalog when trying to execute SSIS Package programmatically
因此,在过去的 2 天里,我一直在尝试从我的 SharePoint 事件接收器执行 SSIS 包,结果几乎发疯了。
SSIS 包已部署到我的开发环境中的集成服务目录中(SQL Server 2014 及其集成服务与 SharePoint Server 和我的 VS2013 社区版安装在同一台计算机上)。
Successfully open SSISDB Catalog from SSMS
到目前为止,这是我的代码,基本上遵循此博客中的步骤 -> http://microsoft-ssis.blogspot.co.id/2013/01/call-ssis-2012-package-within-net.html
connString = @"Data Source=PIRSRV03;Initial Catalog=master;Integrated Security=SSPI;";
using (SqlConnection sqlConnection = new SqlConnection(connString))
{
IntegrationServices integrationServices = new IntegrationServices(sqlConnection);
PackageInfo myPackage = integrationServices.Catalogs[integrationServiceCatalog].Folders[integrationServiceFolder].Projects[integrationServiceProject].Packages[integrationServicePackage];
Collection<PackageInfo.ExecutionValueParameterSet> executionValueParameterSet = new Collection<PackageInfo.ExecutionValueParameterSet>();
executionValueParameterSet.Add(new
PackageInfo.ExecutionValueParameterSet { ParameterName = "ExcelFilePath", ParameterValue = TempDirectory, ObjectType = 30 });
long executionIdentifier = myPackage.Execute(false, null, executionValueParameterSet);
ExecutionOperation executionOperation = integrationServices.Catalogs["SSISDB"].Executions[executionIdentifier];
// Workaround for 30 second timeout:
// Loop while the execution is not completed
while (!(executionOperation.Completed))
{
// Refresh execution info
executionOperation.Refresh();
// Wait 5 seconds before refreshing (we don't want to stress the server)
System.Threading.Thread.Sleep(5000);
}
}
一切正常,直到访问目录 SSISDB 并抛出错误的代码行,
经过一些调试会话后,我发现 integrationServices 对象没有任何目录,通过观察 Catalogs.Count 属性 在这种情况下等于零。
有没有关于为什么会发生这种情况的提示?
非常感谢任何帮助,谢谢!
在我的 DBA 的帮助下花了几个小时试图找出问题后,
事实证明,运行我的事件接收器的 SharePoint Services 帐户无权访问我的集成服务目录,因此目录计数为零。
我们为解决此问题所做的一切只是向 SharePoint Services 帐户授予系统管理员权限。
希望这对某人有帮助,谢谢!
因此,在过去的 2 天里,我一直在尝试从我的 SharePoint 事件接收器执行 SSIS 包,结果几乎发疯了。
SSIS 包已部署到我的开发环境中的集成服务目录中(SQL Server 2014 及其集成服务与 SharePoint Server 和我的 VS2013 社区版安装在同一台计算机上)。 Successfully open SSISDB Catalog from SSMS
到目前为止,这是我的代码,基本上遵循此博客中的步骤 -> http://microsoft-ssis.blogspot.co.id/2013/01/call-ssis-2012-package-within-net.html
connString = @"Data Source=PIRSRV03;Initial Catalog=master;Integrated Security=SSPI;";
using (SqlConnection sqlConnection = new SqlConnection(connString))
{
IntegrationServices integrationServices = new IntegrationServices(sqlConnection);
PackageInfo myPackage = integrationServices.Catalogs[integrationServiceCatalog].Folders[integrationServiceFolder].Projects[integrationServiceProject].Packages[integrationServicePackage];
Collection<PackageInfo.ExecutionValueParameterSet> executionValueParameterSet = new Collection<PackageInfo.ExecutionValueParameterSet>();
executionValueParameterSet.Add(new
PackageInfo.ExecutionValueParameterSet { ParameterName = "ExcelFilePath", ParameterValue = TempDirectory, ObjectType = 30 });
long executionIdentifier = myPackage.Execute(false, null, executionValueParameterSet);
ExecutionOperation executionOperation = integrationServices.Catalogs["SSISDB"].Executions[executionIdentifier];
// Workaround for 30 second timeout:
// Loop while the execution is not completed
while (!(executionOperation.Completed))
{
// Refresh execution info
executionOperation.Refresh();
// Wait 5 seconds before refreshing (we don't want to stress the server)
System.Threading.Thread.Sleep(5000);
}
}
一切正常,直到访问目录 SSISDB 并抛出错误的代码行, 经过一些调试会话后,我发现 integrationServices 对象没有任何目录,通过观察 Catalogs.Count 属性 在这种情况下等于零。
有没有关于为什么会发生这种情况的提示?
非常感谢任何帮助,谢谢!
在我的 DBA 的帮助下花了几个小时试图找出问题后, 事实证明,运行我的事件接收器的 SharePoint Services 帐户无权访问我的集成服务目录,因此目录计数为零。
我们为解决此问题所做的一切只是向 SharePoint Services 帐户授予系统管理员权限。
希望这对某人有帮助,谢谢!