Jon Vinson
Jon Vinson

Reputation: 193

Connecting to Azure VM from Azure App Service

I have an Azure virtual machine, on which a process listens on a certain port. A Node.js application on my local computer is able to connect to this process using the VM's public IP address. But the same Node.js application, deployed as an app service on Azure, is apparently not able to connect using any IP address, despite the fact that the VM allows all incoming traffic on all ports.

(Details: The VM process is running "q" (kdb+), and the Node.js application is using the "node-q" package to connect to it. Both the Azure VM and the Azure app service are Linux, but the local version of the app service is on Windows. The Azure app service is able to connect to my Azure SQL database.)

Any insights into this problem would be appreciated.

Upvotes: 0

Views: 1313

Answers (2)

Jon Vinson
Jon Vinson

Reputation: 193

It was faulty deployment. I didn't include all dependencies in the upload to Azure. Thank you.

Upvotes: 0

Nancy Xiong
Nancy Xiong

Reputation: 28294

There are many reasons for Bad gateway error, probably you could verify these factors on your side:

  • Azure VM side. Make sure the Azure VM is running and the process port is listening when you request a connection from an application. You could run sudo netstat -plnt on Linux VM to check the listening ports. Or, a server can crash if it has exhausted its memory, due to a multitude of visitors on site or a DDOS attack.
  • Firewall blocks a request. You should allow all incoming traffic or Azure web app service outbound traffic on this listening port on the VM. In this scenario, you could verify the Network Security Group configuration for the VM and firewall inside the VM if you have. You could find NSG settings by clicking Virtual machine--Settings---Networking---inbound port rules on the Azure portal.
  • Faulty programming. It seems the Node.js application could work locally.
  • Temporary issue. Sometimes, there is no real issue but your browser thinks there is one thanks to an issue with your browser, a problem with your networking equipment, or some other reasons. You could refresh your web browser or clear cache and cookies to get the page back what you are looking for. More details you can refer to fixing 502 error.

If you still have any question, feel free to let me know.

Upvotes: 0

Related Questions