This project is read-only.

debugging and iisnode

Jun 7, 2014 at 5:22 AM
Hi Guys, great project!
Is there any way I can run & debug node apps hosted in IIS or IIS express direct from VS using this plugin?
I'm using iisnode & vs2013 express for web - I had a play around but looks like currently it has to use the nodeJS server?
Jun 7, 2014 at 8:44 PM
There's no direct support for such a use case, but in practice a lot of it is covered by other features like remote debugging and Azure publishing, if you combine them in the right spot.

First of all, I would recommend starting with one of the Azure project templates in File -> New Project - this will give you web.config that is correctly configured for iisnode. Then, have a look at the documentation on publishing - while this describes Azure, you can change the publish target to be something else entirely, including your own web server, so long as it supports IIS Web Deploy or other protocol that VS web publish supports. It will also open the website in the browser if publish succeeds.

With respect to debugging, the tricky part is to make iisnode open a debug socket. It does have some provisions for that, but they're combined with node-inspector support, so when you enable it node-inspector will immediately attached to the opened socket, making it impossible to attach VS. The hack that we've used to work around this for our Azure remote debugging is to pass "--debug" in iisnode/@interceptor in web.config. Once that is done, you can use the steps described here (ignoring all the stuff above about setting up a proxy etc) to attach to your node.exe processes - just make sure that they are actually running when you try to attach! (iisnode won't spin them up until it needs to, so you need to load some page from your website first).

Again, if you start from an Azure project template, you will get a web.debug.config file that adds "--debug" for you - just make sure to deploy your website in Debug configuration, rather than the default Release. It will do a bunch of other stuff to set up a websocket proxy for the debug socket that is really only useful for Azure (or if your server is behind a firewall that does not permit direct connections for anything other than HTTP), but you can just ignore that. These docs cover it in more detail, but note that Server Explorer integration is Azure-specific.

Hope this helps!
Jun 8, 2014 at 2:28 AM
This is great thank you. I will go through in detail and let you know how it goes. Thanks!