XMLHttpRequest: network error 0x2efd, operation could not be completed due to error 00002efd

I am using socket.io for an azure project for windows. It is strange that the socket.io server starts when I just deploy the web role, but when I deploy the entire cloud project, the socket.io server does not start, and I get this error -

"SCRIPT7002: XMLHttpRequest: Network Error 0x2efd, Could not complete the operation due to error 00002efd."

I have no idea what that means. Can someone help me on this? I hit my head about it all day.

SocketClient.html

<script>
var socket = io.connect('http://127.0.0.1:4001');
socket.on('news', function (data) {
    console.log(data);       
});

$(function () {
    $("#sendresponse").bind("click", function () {
     socket.emit('server', 'Hello World');

    });
}
);
</script>

App.js

var app = require('express')(), server = require('http').createServer(app), io = require('socket.io').listen(server);

server.listen(4001);

app.get('/', function (req, res) {
res.sendfile(__dirname + '/index.html');
});

io.sockets.on('connection', function (socket) {
socket.emit('news', { hello: 'first time connect' });
socket.on('server', function (data) {
    console.log(data);
    socket.emit('news',"hello");
});
});
+5
source share
1 answer

, App.js script , , iisnode, web.config, , . , bin -, - ChangeConfig.ps1, download.ps1, node CMD, setup_web.cmd. , . , , ServiceDefinition.csdef

<Startup>      
 <Task commandLine="setup_web.cmd &gt; log.txt" executionContext="elevated">
    <Environment>
      <Variable name="EMULATED">
        <RoleInstanceValue xpath="/RoleEnvironment/Deployment/@emulated" />
      </Variable>
      <Variable name="RUNTIMEID" value="node;iisnode" />
      <Variable name="RUNTIMEURL" value="" />
    </Environment>
  </Task>
</Startup>

!! . socket.io, 127.0.0.1/App.js . , App.js programattically.

+3

All Articles