繁体   English   中英

我在哪里将edge.js的dll放入访问

[英]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的示例测试

有人知道上面的答案,“在同一目录中是脚本”,是否正确? 我得到了相同的'无法找到元数据文件'。 BenYeomons,那对你有用吗?

stuartd的评论在将dll放在与脚本相同的目录(我曾经尝试过)的意义上是正确的,但我仍然遇到同样的问题。 我通过将C#代码作为单独的文件解决了我的问题,然后将该文件作为executeSSIS函数的一部分引用如下。 payload只是从我的node.js脚本传递到我的C#脚本的对象。 这样做解决了我的问题。

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);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM