如何使用SQL Server身份验证模式从.NET Webapi执行SSIS包?

时间:2019-03-28 11:57:16

标签: c# sql-server authentication ssis

我有以下代码可以从.Net Webapi执行SSIS包,如下所示:

            string targetServerName = "1.x.x.x";
            string folderName = "MyFolder";
            string projectName = "MyProject";
            string packageName = "Package.dtsx";

            // Create a connection to the server
            string sqlConnectionString = "Data Source=" + targetServerName +
                ";Initial Catalog=master;User ID=sa; Password=abcd@1234;Persist Security Info=True;";
            SqlConnection sqlConnection = new SqlConnection(sqlConnectionString);

            // Create the Integration Services object
            IntegrationServices integrationServices = new IntegrationServices(sqlConnection);

            // Get the Integration Services catalog
            Catalog catalog = integrationServices.Catalogs["SSISDB"];

            // Get the folder
            CatalogFolder folder = catalog.Folders[folderName];

            // Get the project
            ProjectInfo project = folder.Projects[projectName];

            // Get the package
            PackageInfo package = project.Packages[packageName];

            // Run the package
            package.Execute(false, null);

但是当我运行这段代码时,出现以下异常:

  

使用SQL Server身份验证的帐户无法启动该操作。使用Windows帐户启动操作   身份验证。

我应该怎么做才能从sql server身份验证模式执行SSIS包?任何帮助将不胜感激。

Error Message

0 个答案:

没有答案