Listen additional port Microsoft Azure Nodejs

雨燕双飞 提交于 2019-12-17 07:53:14

问题


I'm running nodejs application (Azure Web App) on port process.env.PORT (1337), default port on Microsoft Azure. Also I need to listen additional port for websocket. On my local I'm using 8000, but seems, that it's closed on Azure.

Are there any additional ports, that I can listen and is it actually possible at all?


回答1:


If you're deploying to an Azure Web App, only ports 80 and 443 are public-facing. This maps to a specific port for your app to listen to, retrievable via process.env.PORT. And if you're running both in Azure and locally, you can easily manage which port you listen to, with something like this, based on your reference to port 1337 in your question:

var port = process.env.PORT || 1337;

If you needed to listen in on multiple ports, or ones different from 80/443, you'd need to deploy to a VM or a Cloud Service (web/worker role). Or deploy multiple web apps.



来源:https://stackoverflow.com/questions/36424405/listen-additional-port-microsoft-azure-nodejs

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!