I'm trying to establish a TCP connection between an on-prem client and an Azure VM (Standard D1 v2) running Windows 2K16.
On the VM I'm running a simple TCP server (see code below) that receives the port. I've passes port 51515 in the arguments.
The network interface have a public IP I'm trying to use.
I've added an inbound port rule on TCP port 51515 on the portal (source=any, source port=*, destination=any, dest. port=51515, protocol=TCP, action=allow).
Windows Firewall on the VM is off (public, domain and private).
I'm using Telnet from the on-prem side, using the public IP and the 51515 port. Getting the could not open connection message there.
I've tried accessing the IIS on the VM and it is accessible from the on prem using another inbound rule.
Any idea?
Thanks,
Tom
class Program
{
static void Main(string[] args)
{
try
{
var server = new TcpListener(new IPEndPoint(IPAddress.Loopback, int.Parse(args[0])));
server.AllowNatTraversal(true);
server.Start();
server.AcceptTcpClientAsync().ContinueWith(c => System.Console.WriteLine("Client connected from:" + c.Result.Client.RemoteEndPoint));
System.Console.WriteLine("server listens... press any key to exit");
System.Console.ReadKey();
}
catch (Exception e)
{
System.Console.WriteLine(e);
System.Console.WriteLine("press any key to exit");
System.Console.ReadKey();
}
}
}