Cannot Stop SSIS Package at Run Time (.NET C #)

I am trying to stop SSIS packets at runtime using this code

RunningPackages pkgs = app.GetRunningPackages("myserver");

foreach (RunningPackage p in pkgs)
{
    Console.WriteLine("PackageName: " + p.PackageName);
    p.Stop();
}

Runtime errors

However, when I debug the pause between each package stop and move on to viewing the running packages in SQL Server Manage Studio, I still see all the packages.

I even try to right-click and choose a stop on running packages, and they will not stop.

If anyone has an understanding of this, please advise me, I combed through Google and can’t find anything. Any help would be greatly appreciated.

+3
source share
2 answers

According to MSDN ,

Stop Integration Services, , . , , .

( , /, ), , , . , .

, , . . , , , . , , .

EDIT: " " " "

, , SSIS . , , . .

, , , Data Flow? , , ( , ).

using System.Diagnostic;
...
void StopAllPackages() {
    // Get all processes executing an SSIS package on the database server.
    // If you run this on the database server itself, remove the second parameter
    // from GetProcessesByName.
    foreach(Process p in Process.GetProcessesByName("dtexec.exe","databaseServerMachine") {
        try { p.Kill(); }
        catch(Win32Exception w32e) {
            // process was already terminating or can't be terminated
        }
        catch(InvalidOperationException ioe) {
            // process has already exited
        }
    }
}

- SQL Server (.. Activity Monitor) SQL Server, .

+2

, ? , sql clr?

+1

Source: https://habr.com/ru/post/1776868/


All Articles