node.js - 学习nodejs+,写简易http服务器实例时,浏览器访问127.0.0.1无法连接
巴扎黑
巴扎黑 2017-04-17 15:20:18
0
7
549

使用Firebug查看,发现该请求的状态码为红色的 "aborted"。经过百度说是连接超时,跟浏览器有关,但我换了几个浏览器都是一样的结果。到底是什么原因呢?

巴扎黑
巴扎黑

reply all(7)
洪涛

You can debug in the project to determine the problem that occurred at that step
If it is not included in the code at all, it means that the service is not up, or there is a configuration problem
Step by step to eliminate the possibility, be good at debug, hehe

伊谢尔伦

Check whether your res or response is returned in time

Peter_Zhu

Open firebug, click on the network request, and see if there are more details in the response?

大家讲道理

Check whether the port is correct

Peter_Zhu

Check whether the port is occupied. If so, kill the occupied port
lsof -i:xxxx xxxx is the port
kill -9 PID

小葫芦
  1. Check whether the server is opened successfully

  2. Check whether the port is correct or duplicate

  3. Try using [http://localhost:port number] instead (affected by other programs or software, it is very likely that http://ip:port cannot be accessed)

  4. Check whether the access path is correct (related to the configuration, the reason is that access to a certain directory may only be set, and other directories cannot be accessed, so the url needs to be rewritten)

洪涛

I think the front-end should do its job honestly and well. Don’t think that just because node.js can write the back-end, you should think that others’ years of Java back-end reading has been wasted.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template