1

I have developed a chat application with nodejs. Currently, I am using the chat server hosted from a command prompt. This chat server is not bound to any domain name. I want it to bind to a domain with IIS. I have also tried to install IIS Node but could not get through. I have all my chat code in chatroom.js file, there is no HTML file to be rendered. I am not clear how to host it with IIS Node. I am using IIS 8 on Windows 8. The error I am get when hit the URL : http://localhost:3004/chatRoom.js HTTP Error 500.21 - Internal Server Error Handler "iisnode-socketio" has a bad module "iisnode" in its module list Below is my web.config :

<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
</system.web>
<system.webServer>
<!-- indicates that the server-faye.js and server-socketio.js files are node.js applications
to be handled by the iisnode module -->
<handlers>
<add name="iisnode-socketio" path="chatRoom.js" verb="*" modules="iisnode" />
</handlers>
<!-- indicate that all strafic the URL paths beginning with 'socket.io' should be
redirected to the server-socketio.js node.js application to avoid IIS attempting to
serve that content using other handlers (e.g. static file handlers)
-->
<globalModules>
<add name="iisnode" image="C:\Program Files (x86)\iisnode-express\iisnode.dll" />
</globalModules>
<rewrite>
<rules>
<clear />
<rule name="cdw">
<match url="/*" />
<action type="Rewrite" url="chatRoom.js" />
</rule>
</rules>
</rewrite>
<!-- disable the IIS websocket module to allow node.js to provide its own
WebSocket implementation -->
<webSocket enabled="false" />
</system.webServer>
</configuration>

node server side code looks as follows :

var express = require('express'),
http = require('http'),
app = express(),
server = http.createServer(app),
io = require('socket.io').listen(server),
Room = require('./room.js'),
defaultValues = require('./default.js'),
_ = require('underscore')._;
var request = require('request');
//require('request').debug = true; // uncomment for debugging
app.use('/', express.static(__dirname + '/public'));
server.listen(process.env.PORT);
app.get('/', function (req, res) {
res.sendFile(__dirname + '/public/indexroom.html')
});

Please let me know if I am missing anything.

Poojan
  • 11
  • 2
  • make sure you installed iisnode. set the handler: url rewrite rule: and – Jalpa Panchal Jan 07 '20 at 06:52
  • you could refer this article for more detail: [link1](https://tomasz.janczuk.org/2013/01/hosting-socketio-websocket-apps-in-iis.html) , [link2](https://riptutorial.com/node-js/example/21005/using-socket-io-with-iisnode) ,[link3](https://stackoverflow.com/questions/15979904/iis-node-js-and-web-application-with-iisnode-not-configured-right-with-virtual/31482232#31482232) – Jalpa Panchal Jan 07 '20 at 06:53

0 Answers0