Node.js and (ASP.NET or MVC4) - can they be integrated? Can they exist together in a single Azure role?

Unanswered Node.js and (ASP.NET or MVC4) - can they be integrated? Can they exist together in a single Azure role?

  • Monday, January 16, 2012 8:29 PM
     
     

    Node.js sounds great for getting timed page updates.  But is there some way to integrate the code with ASP.NET or MVC4 so that they can live together in a single Azure role?

    The problem I want to solve is frequently polling the server from a web page so that I can update information displayed on the page as more current data becomes available.

    Would like to know how to think about this and what my options might be and what tradeoffs there might be.

All Replies

  • Tuesday, January 17, 2012 1:18 PM
    Moderator
     
     

    Hi,

    I suggest you refer the following article for more details about Node.js and MVC:

    http://weblogs.asp.net/jgalloway/archive/2011/10/26/using-node-js-in-an-asp-net-mvc-application-with-iisnode.aspx

    Hope it can help you.


    Please mark the replies as answers if they help or unmark if not. If you have any feedback about my replies, please contact msdnmg@microsoft.com Microsoft One Code Framework
  • Tuesday, January 17, 2012 11:00 PM
     
     

    Thank you for your response.

    I had already seen that article before I posted my question.  Perhaps I am not stating what I want well enough.

    I have an ASP.NET 4 code (C#) app and I would like to know if I can integrate that code in a single Azure Role with server-side node.js code.

    In other words, is it possible to have some node.js connections running in the same Web Role as my C# code?

    Parts of my app use web services that are contained in the same Web Role as my app.  I would like to know if I could do something similar with node.js.

    So, can I use server-side node.js in a single web role that contains the rest of my app or not?

    Thank you.

     

  • Wednesday, January 18, 2012 2:51 AM
     
     
    You probably need to change the startup script in such a way that it installs the node.exe under a new process in IIS, using the startup script I assume you should be able to have node.exe running on the same box as your web role.
  • Wednesday, January 18, 2012 3:05 AM
    Moderator
     
     

    Hi,

    I am not very sure what's the "node.js connections" mean. Do you want to use Node.js as the HttpHandler in your application? perhaps you can create this HttpHandler by Node.js and use HttpWebRequest to connect the handler via Web Form or MVC. Just like a normal HttpHandler that writen by C# code.

    Hope it can help you.


    Please mark the replies as answers if they help or unmark if not. If you have any feedback about my replies, please contact msdnmg@microsoft.com Microsoft One Code Framework
  • Monday, January 23, 2012 7:39 AM
     
     

    What I want is a thumbs up or thumbs down on whether a single web role in Azure will allow me to have an ASP.NET Session object and will allow me to update the client page through interactions with the same web role using node.js on the server and client.  Thus the Web Role would be running ASP.NET code that was written in C# and Node.js and I could interact with this single Web role running node.js on the server as well as normal ASP.NET.  This would mean I could access the server via AJAX posts and node.js.  If you ask me anything deeper, I don't think you understand the question.  Asked another way, in a single web role can I have C#/CLR code running and also be running node.js?

     

  • Thursday, September 13, 2012 1:42 PM
     
     
    Well, I think you don't really understand what the asp.net and the node.js . Node.js just make js a new language extreamly like the c sharp language, and they both can work well on the dotNet freamwork, but you have to install the node.js on your server. Asp.net is a form of making website, use pennels and containers to do things for us. So it has nothing with the language that you use, you can just replace the statement in the head line with statement: script language is javascript, that's okay. If there's something wrong, welcome for telling me.Thanks.