2016-03-29 18 views
0

OS接続する - Windowsの10プロ
のNode.jsを - 5.9.1のNode.js/Expressのエラー:ECONNREFUSED 127.0.0.1:5000

こんにちはうた、

は、だから私は、上記を取得していますnodeJS/Expressの下でアプリケーションを実行するとエラーメッセージが表示されます。次のように

私のサーバー/ app.jsファイルは次のとおりです。

'use strict'; 
 

 

 
// Set default node environment to development 
 

 
var connectionString = config.mongo.connectionstring; 
 

 
console.log("connection string : " + connectionString); 
 
mongoose.connect(connectionString); 
 

 
// Setup server 
 
var app = express(); 
 
var httpsOptions = { 
 
    key: fs.readFileSync('../server/privatekey.pem'), 
 
    cert: fs.readFileSync('../server/certificate.pem') 
 
}; 
 
var baseAddress = 5000; 
 
var redirectAddress = 5001; 
 
var httpsAddress = 5002; 
 

 
net.createServer(tcpConnection).listen(baseAddress); 
 
http.createServer(httpConnection).listen(redirectAddress); 
 
https.createServer(httpsOptions, httpsConnection).listen(httpsAddress); 
 

 
function tcpConnection(conn) { 
 
    conn.once('data', function (buf) { 
 
     // A TLS handshake record starts with byte 22. 
 
     var address = (buf[0] === 22) ? httpsAddress : redirectAddress; 
 
     var proxy = net.createConnection(address, function() { 
 
      proxy.write(buf); 
 
      conn.pipe(proxy).pipe(conn); 
 
     }); 
 
    }); 
 
} 
 

 
function httpConnection(req, res) { 
 
    var host = req.headers['host']; 
 
    res.writeHead(301, { "Location": "https://" + host + req.url }); 
 
    res.end(); 
 
} 
 

 
function httpsConnection(req, res) { 
 
    res.writeHead(200, { 'Content-Length': '5' }); 
 
    res.end('HTTPS'); 
 
} 
 

 
// Expose app 
 
exports = module.exports = app;

私はここで何を望むのですか?事前

答えて

0

おかげで、あなたのアプリケーションがポート3000でリッスンしながらポート5000に接続しようとしているので。

関連する問題