Hiten Pandya

Hiten Pandya

  • 575
  • 1.9k
  • 23.6k

Azure web app open other ports for TCP communication

Feb 28 2023 8:17 AM

Hello everyone,

I am facing one issue so, trying to explain the whole scenario.

Final Result :
I am having a TCPClient (a console application) which will send data to TCPListener (a web app hosted on azure).

Implementation :

  1. Created one simple web application which will act as a TCP Listener. Add logs to see the received message from TCP Client.
  2. Add Dockerfile
  3. In dockerfile expose the port 8080 for TCP communication.
  4. Publish the application on azure container repository
  5. Create one console application for sending data to listener.
  6. The TCPClient will connect to host my-app.azurewebsites.net and port 8080

Problem :

TCP Client (local console application) is not able to connect to the TCP listener. By default web app allows only 80 and 443 port. So, to open other ports tried below solutions,

  1. Create virtual network
  2. Create Network Security Group and add the virtual network as subnet
  3. Add Inbound Security Rules in NSG.
  4. Create a azure web app and assign the virtual network.
  5. Also try to set the WEBSITES_PORT in web app configuration

None of the above solution works. Also tried to check port via telnet and connection failed which means port is not open. I am stuck here don't know which part is missing.

Any help is appreciated.

Thanks.


Answers (2)