Calling local SSIS package from C# console application - c#

I'm trying to run a local SSIS package from a C# console application. I've built both the package and the application using .Net 4.5.1 in VisualStudio 2012. When I say "local" I mean the SSIS package hasn't been deployed to a SQL Server; I'm just trying to call the .dtsx file from the file system. The SSIS package runs fine from within VisualStudio. Here's my code:
string pkgLocation = #"C:\Users\06717\Documents\Visual Studio 2012\Projects\RMA_Data_Cleanup\RMA_Data_Cleanup\";
string pkgName = "Package.dtsx";
Application app = new Application();
Package pkg = new Package();
DTSExecResult pkgResults = new DTSExecResult();
try
{
pkg = app.LoadPackage(pkgLocation + pkgName, null);
There's more after this, obviously, but the problem comes with the app.LoadPackage line. When I try to run it, this exception gets thrown:
The package failed to load due to error 0xC0011008 "Error loading from XML. No further detailed error information can be specified for this problem because no Events object was passed where detailed error information can be stored.". This occurs when CPackage::LoadFromXML fails.
I've googled this error message, and I haven't found anything that seems to apply to my case. One thing that occurs to me is that maybe I'm calling the wrong dtsx file. There's another one in the obj\Development folder. I've tried calling that one too, but I get the same exception. Am I calling the right file? Is there something I need to do from within Visual Studio, other than build the package, before I can do this? (pkgResults = Success, BTW)

Related

JsReport using C# .NET core and Vs

I am trying to learn JsReport using c# and .NET core and visual studio. I have installed the required nuget packages (jsreport.binary and jsreport.Local). I am trying to replicate the code found Here. The problem is that I keep getting the following error.
***Severity Code Description Project File Line Suppression State
Error MSB3021 Unable to copy file "C:\Users\jmodiba\source\repos\js\js\obj\Debug\net6.0\apphost.exe" to "bin\Debug\net6.0\js.exe". Access to the path 'bin\Debug\net6.0\js.exe' is denied. js C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets 5097***
here is the code,
using jsreport.Binary;
using jsreport.Local;
using jsreport.Types;
var rs = new LocalReporting().UseBinary(JsReportBinary.GetBinary()).AsUtility().Create();
await rs.RenderAsync(new RenderRequest()
{
Template = new Template()
{
Recipe = Recipe.ChromePdf,
Engine = Engine.None,
Content = "Hello from pdf"
}
});
I managed to find the problem. My antivirus kept on moving the .exe file created to quarantine. Once I created an exception in the antivirus setting my code ran correctly.

How Can I connect to DB2 (version v11.1.0.1527) with Function apps?

I'm trying to connect to DB2 with function apps, but I have problems with DB2 dlls.
I receive this error during the debug of my function app, using latest versions of IBM.Data.DB2.Core nuget packages (1.3.0.100) :
{'Unable to load DLL 'db2app64.dll' or one of its dependencies: The specified module could not be found. (0x8007007E)'}
This line generate the exception:
using (DB2Connection conn = new DB2Connection(str))
The specified dll is present in folder, so someone know what should be the problem?
This could happen if you have the IBM.DataDB2.dll file lying around in directories other than the DB2 client install location. This could have happened without your knowledge where Visual Studio copies the necessary dll into the bin directory of the project.
Same question or the duplicate of IBM.Data.DB2.Core throws exception in azure function app

Running SSIS Package from WinForms app - Gnarly Error

I have a winforms application that makes use of Microsoft.SqlServer.ManagedDTS to load and execute an SSIS package. When running locally in debug and when installed the package runs fine, when installed on a dev server the package runs fine. When deployed onto a live server I get the following error.
I'm running out of ideas of what to check, I don't want to move away from using this method of executing my package as this adds further complication to the application that we really don't want to introduce. Any thoughts?
For clarity I have checked:
SSIS is installed and is the same version (Windows/SQL Server 2008)
I added the following app.config key following some google searching useLegacyV2RuntimeActivationPolicy="true"
Tried compiling as a 32-bit and 64-bit application
Ensured that the DLL is registered in the GAC on the target machine
All permissions are the same across the two boxes
The extract of source code that is throwing the error is as follows:
var app = new Microsoft.SqlServer.Dts.Runtime.Application();
var pkg = app.LoadPackage(strSSISPath, null);
pkg.ImportConfigurationFile(strSSISConfig);
var result = pkg.Execute();
if (result.Equals(DTSExecResult.Success))
{
string strMsg = strMHType + " extract completed successfully.";
MessageBox.Show(strMsg, strMHType, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
foreach (var err in pkgMHMDS.Errors)
{
MessageBox.Show(err.Description, strMHType, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
MessageBox.Show(strMHType + #" extract failed!", strMHType, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
pkgMHMDS.Dispose();
The error that we see (the COM class error) is caused because the version of the Microsoft.SqlServer.ManagedDTS dll is not installed on the target machine. Whilst we did install the dll into the GAC we couldn’t work round the error because Integration Services is a server component and is not redistributable to client computers. The error isn’t terribly informative but essentially what it is trying to say is that it is trying to load an assembly who’s address is stored in the registry key which is created when installing the Client Tools SDK.

Trying to manually run SSIS package on MSDB but getting error

I am trying to run my SSIS packages on MSDB with a console application, but I keep getting an error.
Application app = new Application();
Package package = app.LoadFromSqlServer("\\File\\Path\\" + paramName, ".", "MSDBUser", "password", null);
DTSExecResult result = package.Execute();
Console.WriteLine("Package Execution Results: {0}", result.ToString());
I keep getting the error:
"The Execute method on the task returned error code 0x80131621 (Mixed mode assembly is
built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0
runtime without additional configuration information.). The Execute method must
succeed, and indicate the result using an \"out\" parameter.\r\n"
I am thinking it has to do with the way I am calling the package to run my be outdated, but I am not really sure. Would anyone be able to help me out and provide some input on a better way to do this? Any help would be much appreciated. Thanks!
it seems that you've created a 4.0 framework project and now, you are trying to use 2.0 framework. In this post you can find all the settings you need in order to solve your problem.

Skydrive the operation has timed out

I am trying to connect to skydrive with this code, it is console C# application:
var client = new SkyDriveServiceClient();
client.LogOn("username", "password");
and I got this exception: The operation has timed out.
Anyone know what is solution for this problem?
Ok, download the latest version (Changset 68942) from this
location. After download open the project (located in folder trunk/src/SkyDriveServiceClient.sln) in Visual Studio and change the variable SkyDocsServiceUri in the class SkyDocsServiceClient to the following:
public static readonly Uri SkyDocsServiceUri = new Uri("https://docs.live.net/SkyDocsService.svc");
After the change compile the project to build the assembly file. Then you need to reference the assembly from your project and try to execute your code again.

Categories

Resources