0

I would like to run node.js with asp.net mvc for performing socket.io operations.

i've successfully included the node.js in asp.net mvc as described in here

my problem is how to run express.js in asp.net mvc,

i've performed the url rewritting in Global.asax.cs file like

void Application_BeginRequest(object sender, EventArgs e)
{
// Get current path
string CurrentPath = Request.Path.ToLower();
if (CurrentPath.StartsWith("/node"))
{ HttpContext MyContext = HttpContext.Current;
MyContext.RewritePath("/Node/index.js/");
}
}

so in the url http:localhost:1234/node should redirect me to the index.js file in Node folder

it is all working well but, when i start coading express.js server in index.js like

var express = require('express');

var app = express.createServer();

app.get('/node/', function (req, res) {
res.send(' welcome to express ');
});

app.listen(process.env.PORT);

I got error saying Cannot GET /Node/index.js/

where am i missing? please guide me how to write express.js coading in asp.net mvc

Iam running this application in windows 7 32 bit system with IIS 8.0 express , and installed node versions are
iisnode.js - iisnode-full-iis7-v0.2.3-x86
node.js - node-v0.8.19-x86

Thank you.

Kasi
  • 129
  • 2
  • 9

1 Answers1

0

Do you have a web.config entry for iisnode handling index.js?

iisnode is not set up as a .js handler by default, since there is far more client-side javascript than server-side javascript, so you need to explicitly turn on iisnode as a handler for that file.