приложение чата host nodejs с узлом iis - PullRequest
1 голос
/ 06 января 2020

Я разработал приложение для чата с nodejs. В настоящее время я использую сервер чата, размещенный в командной строке. Этот чат-сервер не привязан ни к какому доменному имени. Я хочу привязать его к домену с помощью IIS. Я также пытался установить IIS Node, но не смог пройти. У меня есть весь код чата в чате. Файл js, файл HTML не отображается. Я не знаю, как разместить его с IIS Node. Я использую IIS 8 на Windows 8. Ошибка при получении URL-адреса: http://localhost: 3004 / chatRoom. js Ошибка HTTP 500.21 - Внутренний обработчик ошибок сервера "iisnode-socketio "имеет неверный модуль" iisnode "в списке модулей. Ниже приведен мой 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>

код серверной части узла выглядит следующим образом:

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')
});

Пожалуйста, дайте мне знать, если Я что-то упускаю.

...