search

Home  >  Q&A  >  body text

node.js - 学习nodejs+,写简易http服务器实例时,浏览器访问127.0.0.1无法连接

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

巴扎黑巴扎黑2865 days ago569

reply all(7)I'll reply

  • PHP中文网

    PHP中文网2017-04-17 15:22:18

    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

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-17 15:22:18

    Check whether your res or response is returned in time

    reply
    0
  • 天蓬老师

    天蓬老师2017-04-17 15:22:18

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

    reply
    0
  • 大家讲道理

    大家讲道理2017-04-17 15:22:18

    Check whether the port is correct

    reply
    0
  • 天蓬老师

    天蓬老师2017-04-17 15:22:18

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

    reply
    0
  • 高洛峰

    高洛峰2017-04-17 15:22:18

    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)

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 15:22:18

    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.

    reply
    0
  • Cancelreply