我在哪里可以将dll for edge.js访问(Where do I put the dlls for edge.js to access)

编程入门 行业动态 更新时间:2024-10-27 22:27:00
我在哪里可以将dll for edge.js访问(Where do I put the dlls for edge.js to access)

我一直在使用edge.js从Node.js应用程序中调用C#函数,但是当我去执行C#代码时,例如:

无法找到元数据文件'System.Collections.Generic.dll'

元数据文件'System.Text.dll'找不到

...

我的代码如下,基本上想要使用我从C#调用的存储过程运行SSIS包。 基本上我所有的被引用的dll都找不到? 我应该在哪里放置DLL来找到它们?

var executeSQL = edge.func(function() { /* #r "System.Data.dll" #r "System.Collections.Generic.dll" #r "System.Linq.dll" #r "System.Text.dll" using System.Linq; using System.Text; using System.Data; using System.Collections.Generic; using System.Threading.Tasks; public class StartUp { public async Task<object> Invoke(object input) { string result = string.Empty; string packagePath = @"\SSISDB\test\package.dtsx"; string spName = "storedProcName"; using (var conn = new System.Data.SqlClient.SqlConnection("connectionString")) using (var command = new System.Data.SqlClient.SqlCommand(spName, conn) { CommandType = System.Data.CommandType.StoredProcedure }) { conn.Open(); command.Parameters.AddWithValue("@PackagePath", packagePath); command.ExecuteNonQuery(); Console.WriteLine("Finished"); }; return null; } } */ });

我知道我可以在不使用C#的情况下执行此操作,只需在像mssql这样的节点中使用模块来执行存储过程,但这只是一个习惯使用edge.js的示例测试

I have been using edge.js to call a C# function from within my Node.js app, however when I go to execute the C# code I get for example:

Metadata file 'System.Collections.Generic.dll' could not be found

Metadata file 'System.Text.dll' could not be found

...

My code is this below, basically wanting to run a SSIS package using a stored procedure which I am calling from C#. Basically all my referenced dll's can't be found? Where should I put the dlls for edge to find them?

var executeSQL = edge.func(function() { /* #r "System.Data.dll" #r "System.Collections.Generic.dll" #r "System.Linq.dll" #r "System.Text.dll" using System.Linq; using System.Text; using System.Data; using System.Collections.Generic; using System.Threading.Tasks; public class StartUp { public async Task<object> Invoke(object input) { string result = string.Empty; string packagePath = @"\SSISDB\test\package.dtsx"; string spName = "storedProcName"; using (var conn = new System.Data.SqlClient.SqlConnection("connectionString")) using (var command = new System.Data.SqlClient.SqlCommand(spName, conn) { CommandType = System.Data.CommandType.StoredProcedure }) { conn.Open(); command.Parameters.AddWithValue("@PackagePath", packagePath); command.ExecuteNonQuery(); Console.WriteLine("Finished"); }; return null; } } */ });

I know I can do this without C# and just use a module within node like mssql to execute the stored procedure but this was just an example test to get used to using edge.js

最满意答案

有人知道,如果上面的答案,“在同一个目录中是脚本”,是否正确? 我得到了同样的'元数据文件无法找到'。 BenYeomons,是否为你工作?

The comment from stuartd was correct in the sense to put the dlls under the same directory as the script (which I had tried) but I was still having the same issue. I solved my problem by having my C# code as a separate file and then referenced that file as below as part of the executeSSIS function. payload is just the object that gets passed from my node.js script to my C# script. Doing it this way solved my issue.

var payload = { filePath: 'C:/temp/xlsx/' + req.file.filename, path: req.packageName, server: req.server }; var executeSSIS = edge.func({ source: __dirname + '/cs/Program.cs', references: [ __dirname + '/cs/System.Data.dll' ] }); executeSSIS(payload);

更多推荐

本文发布于:2023-04-29 08:39:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1335852.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:我在   edge   dll   js   dlls

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!