问题
I am playing with the Edge.js and were able to run most of the examples but when it comes to using compiled C# dll file, I couldn't get it working.
My node.js code is
var clrMethod = edge.func({
assemblyFile: 'C:\\Users\\hello\\Desktop\\Debug\\DemoClass.dll',
typeName: 'DemoClass',
methodName: 'Invoke'
});
clrMethod(8, function (error, result) {
if (error) {
console.log(error);
throw error;
}
console.log(result);
});
C# DLL code is
using System.Threading.Tasks;
namespace DemoClass
{
public class Startup
{
public async Task<object> Invoke(object input)
{
int v = (int)input;
return Helper.AddSeven(v);
}
static class Helper
{
public static int AddSeven(int v)
{
return v + 7;
}
}
}
}
When trying with the above code it silently passed through the node.js script and doesn't log any result or error. Can someone please guide.
Thanks
来源:https://stackoverflow.com/questions/59841697/cant-call-method-inside-c-sharp-dll-from-node-service-using-edge-js