Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I Use Node.js to Call a C# Method?

I'm working on a Webforms project and I was looking at implementing node.js and issnode. We are using:

  • Web Forms
  • IIS
  • C#
  • Entity Framework
  • SQL Server

We have a page that takes a while to load and were looking at ways to improve its speed. There are a few counts that are being displayed on the page that are useful but are causing the page to load slowly. (We are displaying the total # of tasks, # of people in a group, and number of groups).

I was thinking that I'd be able to directly call my c# code from the node.js file. From the examples I've seen and what I've read it doesn't seem that is the solution I should be looking for. Since we are using EF and I'm not writing SQL queries it looks like I should be interacting with services.

So my question is, can I use Node.js to call my C# methods?

like image 531
Brad8118 Avatar asked Oct 31 '25 20:10

Brad8118


1 Answers

Yes, you can now do this via Edge.js.

From http://www.infoq.com/articles/the_edge_of_net_and_node:

Why use Edge.js?

While many applications can be written exclusively in Node.js, there are situations that require or benefit from a combination of Node.js and .NET. You may want to use .NET and Node.js in your application for several reasons. .NET framework and NuGet packages provide a rich ecosystem of functionality that complements that of Node.js and NPM modules. You may have pre-existing .NET components you want to reuse in a Node.js application. You may want to use multi-threaded CLR to run CPU-bound computations that are not well suited for single-threaded Node.js. Or you may prefer to use .NET Framework and C# as opposed to writing native Node.js extensions in C/C++ to access mechanisms specific to the operating system not already exposed through Node.js.

like image 74
D'Arcy Rittich Avatar answered Nov 02 '25 09:11

D'Arcy Rittich