mla Posted July 26, 2018 Share Posted July 26, 2018 Hi, 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')); }); server.listen(PORT); console.log('Starting server on port '+ PORT); var io = require('socket.io')(server,{}); io.sockets.on('connection', function(socket) { ... Thanks MLA Quote Link to comment Share on other sites More sharing options...
TheBoneJarmer Posted July 26, 2018 Share Posted July 26, 2018 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. ? URL: http://pm2.keymetrics.io/ b10b 1 Quote Link to comment Share on other sites More sharing options...
mla Posted July 31, 2018 Author Share Posted July 31, 2018 Thanks. 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. Quote Link to comment Share on other sites More sharing options...
mla Posted July 31, 2018 Author Share Posted July 31, 2018 Decided to try out the pm2. Seems the issue is that app.js is not found. A nice 404 Error! Quote Link to comment Share on other sites More sharing options...
mla Posted August 3, 2018 Author Share Posted August 3, 2018 FIXED!!! 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.