问题
You can see the interop model for going from Node.js -> C#, here.
What I want to know is, can the C# code then make a call to a method in the Node.js part of the process from the C#, before returning?
Imagine if you had a call, like
var webApi = edge.func('/MyDotNetApi.csx');
webApi(function (error, result) { log.('api started'); });
where the MyDotNetApi.csx returns, but leaves a socket listener thread running to handle HTTP requests. Now, if the Node.js part of the process holds (ever changing) information which the .Net code needs to access for inclusion in its HTTP responses, can it somehow ask Node.js for it?
回答1:
Calling back Node.js from C# with Edge.js is possible and documented.
来源:https://stackoverflow.com/questions/18861687/using-edge-js-is-it-possible-for-the-net-c-sharp-module-to-call-the-node-js-par