尝试以编程方式执行SSIS包时,找不到SSISDB目录
本文关键字:包时 找不到 SSISDB 目录 SSIS 执行 编程 方式 | 更新日期: 2023-09-27 18:29:22
所以在过去的两天里,我一直在尝试从SharePoint事件接收器执行SSIS包,结果几乎疯了。
SSIS包部署到我的开发环境中的Integration Service Catalogs中(SQL Server 2014及其Integration Services与SharePoint Server和我的VS2013 Community Edition安装在同一台计算机上)。从SSMS 成功打开SSISDB目录
到目前为止,这是我的代码,基本上遵循本博客中的步骤->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并抛出错误的代码行,经过一个小的调试会话,我通过观察Catalogs.Count属性发现integrationServices对象没有任何目录,在本例中该属性等于零。
有什么线索表明为什么会发生这种情况吗?
任何帮助都将不胜感激,谢谢!
在DBA的帮助下花了几个小时试图找出问题后,事实证明,运行我的事件接收器的SharePoint Services帐户无权访问我的集成服务目录,因此目录为零。
我们所做的只是向系统管理员授予SharePoint Services帐户的权限。
希望这能帮助一些人几个小时,谢谢!