无法读取未定义的属性'writeHead'

时间:2019-06-18 10:01:59

标签: javascript asp.net

我已经成功托管了一个本地.NET服务器,其网址为:http://localhost:65349/。现在,我想将“ localhost”更改为我的IP地址,以使Web仍在运行,但是,收到400 HTTP错误

我已通过Node.js将iisexpress-proxy下载到我的计算机中,但是,为什么尝试在my.NET项目中运行IIS代理文件,却收到错误消息:“无法读取未定义的属性'writeHead'of undefined”下面的代码。 所以我想问什么是错误以及如何配置。

proxyServer.listen(proxyPort, function() {
  console.log('Listening... [press Control-C to exit]');
}).on('error', function (err, req, res) {
  console.log(err.stack);
  console.log('Listening... [press Control-C to exit]');
  res.writeHead(500, {
    'Content-Type': 'text/plain'
  });
  res.end('Aw snap! Something went wrong. Check your console to see the error.');
});

这是图像错误日志:enter image description here

1 个答案:

答案 0 :(得分:1)

我知道这是一个迟到的答案,但是当我尝试使用已用作代理端口的端口时出现此错误。使用不同的可用端口修复它。

相关问题