简体   繁体   English

express.js 服务器在正在使用的端口上启动

[英]express.js server starts on a port that is being used

Have this setup:有这个设置:

  • expressjs server started from one node process, listening to port 8081 . expressjs 服务器从一个节点进程启动,监听端口8081
  • js client trying to make a request to it from another node process, using node's http module. Node.js 客户端尝试使用节点的http模块从另一个节点进程向它发出请求。
  • client failing with 400 error.客户端因 400 错误而失败。
  • same URL (http://localhost:8081/) is opening in browser just fine.同样的 URL (http://localhost:8081/) 在浏览器中打开就好了。

Spent a few hours trying to troubleshoot it, then tried to change the port and it worked.花了几个小时尝试对其进行故障排除,然后尝试更改端口并且它起作用了。 Turns out there is another process listening on port 8081:原来有另一个进程在监听 8081 端口:

$ lsof -i tcp:8081                                        
COMMAND    PID            USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
EUSAManag 1187 oleksandr.suhak    4u  IPv4 0xce3bb9546cff3ab1      0t0  TCP localhost:sunproxyadmin (LISTEN)

(Have no idea what EUSAManag is) (不知道EUSAManag是什么)

I guess my question is: how could it be that the express server starts fine without complaining to a "port being used by another process" when the port is clearly in use.我想我的问题是:当端口明显在使用时,快速服务器怎么能正常启动而不会抱怨“另一个进程正在使用的端口”。 And why does it work then when accessing it from the browser, but does not work when making request from js client?为什么从浏览器访问它时它可以工作,但从js客户端发出请求时它却不起作用 Any tips on figuring out what is actually happening here?关于弄清楚这里实际发生了什么的任何提示?

If guess that EUSAManager.exe come from one of software https://iit.com.ua/downloads which is in the business of information security.如果猜测EUSAManager.exe来自信息安全业务中的软件https://iit.com.ua/downloads之一。 Most likely their software interfere too much with you operation system.他们的软件很可能对您的操作系统干扰太多。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM