侦听其他端口Microsoft Azure Node.js

编程入门 行业动态 更新时间:2024-10-25 07:17:36
本文介绍了侦听其他端口Microsoft Azure Node.js的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在端口process.env.PORT(1337)(Microsoft Azure的默认端口)上运行nodejs应用程序(Azure Web App). 另外,我需要监听websocket的其他端口.在我的本地计算机上,我使用的是8000,但似乎在Azure上已关闭.

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?

推荐答案

如果要部署到Azure Web App,则只有端口80和443是面向公众的.这会映射到您的应用程序要监听的特定端口,可通过process.env.PORT检索.而且,如果您同时在Azure和本地中运行,则可以基于对问题中端口1337的引用,轻松地管理监听的端口,诸如此类:

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;

如果您需要侦听多个端口或不同于80/443的端口,则需要部署到VM或Cloud Service(Web/工作者角色).或部署多个Web应用.

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.

更多推荐

侦听其他端口Microsoft Azure Node.js

本文发布于:2023-08-07 06:53:12,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1317598.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:端口   Microsoft   Azure   Node   js

发布评论

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

>www.elefans.com

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