Sign in to follow this  

Publishing Nodejs Application

Recommended Posts


I have a nodjs application that is currently saved in Windows 2012 R2 server using IISnode with IIS 8.5.

I am getting a 404 File or directory not found error, however nothing is being recorded in the error logs.  When I run this locally I have no issues and the game runs well. Thinking it could be a permissions issue, I decided to provide temporary read/write access, however that didn't seem to make a difference. I also confirmed that the links are all correct in terms of where files are sitting.  

Here is my server side code:

var PORT = process.env.PORT || 8080;

var express = require('express');
var app = express();
var http = require('http');
var path = require('path');
var util = require("util");
var server = require('http').createServer(app);
var compression = require('compression');

//Get required classes
xyLocation = require("./xyLocation").xyLocation;
app.use(compression()); //Compress all routes

app.use('/client', express.static(__dirname + '/client'));
app.use('/js', express.static(__dirname + '/js'));
app.use('/css', express.static(__dirname + '/css'));
app.use('/sounds', express.static(__dirname + '/sounds'));
app.use('/images', express.static(__dirname + '/images'));

// Routing
app.get('/', function(request, response) {
  response.sendFile(path.join(__dirname, 'index.html'));

console.log('Starting server on port '+ PORT);

var io = require('')(server,{});

io.sockets.on('connection', function(socket) { ...





Share this post

Link to post
Share on other sites

To be honest, I'd give up with IIS and NodeJS and use something else, like PM2. It is a real drag trying to get a NodeJS server up and running on a Windows server with IIS, which was not intended for NodeJS to begin with. Best thing to do is to create it as a task that launches on Windows startup. I don't know how that was done exactly but that is for you to find out than. 😛


Share this post

Link to post
Share on other sites


I managed to get the iis and nodejs working and a simple test page launches great. I'm more faced with a content-security-policy issue and adjustments to my headers don't seem to make a difference.

I may give your pm2 a try if I can't get past this error.

Share this post

Link to post
Share on other sites


I got it working with IIS 8, Windows 2012 server.

The issue was my web.config file needed the proper rewrites. For anyone facing this issue, ensure you update the web.config correctly.

It's all working now. 

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.