"An exception execution error was caused by the target of the call" from the Script task

I have an SSIS package with a script task, I get the following error when I try to run it on my local system. It works great for my colleagues as well as in production. However, I cannot run it locally to check. I save the debug point in the main method, but it has never been reached, I get an error before it goes to the main method.

enter image description here

I am using VS 2010, .Net framework 4.5.

The script task is executed. I get the following messages: SSIS package ".. \ Test.dtsx". Error: 0x1 in test: exception was thrown by the target of the call. Failed to complete the task: complete the verification of the SSIS package ".. \ Test.dtsx": "Success". The program '[2552] DtsDebugHost.exe: DTS' exited with code 0 (0x0).

Below is the code:

public void Main() { try { LogMessages("Update Bug package execution started at :: " + DateTime.Now.ToLongTimeString()); LogMessages("Loading package configuration values to local variables."); strDBConn = Dts.Variables["User::DBConnection"] != null ? Dts.Variables["User::DBConnection"].Value.ToString() : string.Empty; strTPCUrl = Dts.Variables["User::TPCUrl"] != null ? Dts.Variables["User::TPCUrl"].Value.ToString() : string.Empty; TfsTeamProjectCollection objTPC = new TfsTeamProjectCollection(new Uri(strTPCUrl)); WorkItemStore objWIS = new WorkItemStore(objTPC); WorkItemCollection objWIC = objWIS.Query("SELECT..."); foreach (WorkItem wi in objWIC) { } } catch(Exception ex) { } 

When I commented on the code from TfsTeamProjectCollection objTPC = new TfsTeamProjectCollection (new Uri (strTPCUrl)); The script runs successfully. However, if I save TfsTeamProjectCollection objTPC = new TfsTeamProjectCollection (new Uri (strTPCUrl)); and comment on the rest, I get an exception. I have access to the URL.

I am using Microsoft.TeamFoundation.Client.dll and Microsoft.TeamFoundation.WorkItemTracking.Client.dll in my script task. However, the dll version in package 10.0 and the DLL version in my GAC is 12.0. Will this cause a problem?

+9
source share
4 answers

I had the same problem (i.e. the same error code Error: 0x1 ...).

The problem is with some of the libraries referenced by the missing folder.

Removing links and adding them from the correct path fixed the problem.

The Microsoft reference ( https://msdn.microsoft.com/en-us/library/ms345164.aspx ) related to the error code is very general and does not help much. However, while reading other articles, it is likely that this indicates an unknown reason for the failure to run the Script task.

  • Hexadecimal code: 0x1
  • Decimal Code: 1
  • Symbolic name: DTS_MSG_CATEGORY_SERVICE_CONTROL
  • Description: Invalid function.
+2
source

Fixed when link to dll version 12.0.0 was added and Target Framework changed to .Net Framework 4.5

0
source

I received this error message when I referenced the passed ssis variable in Dts.Variables ["User :: xxxx] .Value (); where xxxx did not exist and was not passed from the caller. It was a simple Console.Writeline referring to the passed a variable that does not exist.

0
source

This is just a different situation, and it should not be the ultimate goal of all.

When I installed my DLLs in the GAC, I forgot to run my script as administrator, and the script ran without errors, as if it worked.

I felt really stupid when I realized that I had done wrong. I hope this helps not to waste time on the stupidity of other people.

For reference: this is what I use to install my DLLs in the GAC, and I changed them to tell me when I do not run them as an administrator:

 #https://superuser.com/questions/749243/detect-if-powershell-is-running-as-administrator $isAdmin = ([Security.Principal.WindowsPrincipal] ' [Security.Principal.WindowsIdentity]::GetCurrent() ' ).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) if($isAdmin -eq $false) { Write-Host "You have to run this script as Administrator or it just won't work!" -ForegroundColor Red return; } $strDllPath = "C:\PathToYourDllsHere\" #Note that you should be running PowerShell as an Administrator [System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a") $publish = New-Object System.EnterpriseServices.Internal.Publish $arr = @( "YourDLL01.dll", "YourDLL02.dll", "YourDLL03.dll" ) get-date foreach($d in $arr) { $p = ($strDllPath + $d); $p $publish.GacInstall($p); } #If installing into the GAC on a server hosting web applications in IIS, you need to restart IIS for the applications to pick up the change. #Uncomment the next line if necessary... #iisreset 

Find out how your PowerShell script works in administrator mode or not: https://superuser.com/questions/749243/detect-if-powershell-is-running-as-administrator

0
source

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


All Articles