在我的浏览器中出现服务器禁止错误

编程入门 行业动态 更新时间:2024-09-27 15:26:32

在我的浏览<a href=https://www.elefans.com/category/jswz/34/1771362.html style=器中出现服务器禁止错误"/>

在我的浏览器中出现服务器禁止错误

我刚刚开始探索node.js。已在我的 Windows 服务器上安装了 msi 文件。下面的代码返回了命令窗口中的预期输出

var http = require("http");

http.createServer(function (request, response) {

// Send the HTTP header 
// HTTP Status: 200 : OK
// Content Type: text/plain
response.writeHead(200, {'Content-Type': 'text/plain'});

// Send the response body as "Hello World"
response.end('Hello World\n');
}).listen(8081);

// Console will print the message
console.log('Server running at `http://127.0.0.1:8081/`');

但是当我在浏览器中输入

http://127.0.0.1:8081/
时,我没有得到任何输出。当我看到控制台时,出现以下错误

Failed to load resource: the server responded with a status of 403 (Forbidden)

我错了什么以及如何解决?我正在关注这个链接

回答如下:

可能就像我当前的电脑一样,您的电脑也必须运行 McAfee 或某些其他程序已经使用端口 8081,您有两个选择:

  • 停止 McAfee 或该端口上运行的其他程序
  • 监听节点服务器上的不同端口

更多推荐

在我的浏览器中出现服务器禁止错误

本文发布于:2024-06-15 22:03:21,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1771423.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:器中   错误   服务器

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!