Open a Port for Your Application on Windows Server
A game server, a web server or another program on your server waits for connections on a port, for example 8080. The Windows firewall blocks every port that has no rule, so other computers cannot reach your program until you open its port.
Find out which port and protocol (TCP, UDP or both) your program uses: it is in its documentation or settings.
Open the Port
Open PowerShell as administrator (right-click Start → Terminal (Admin)) and run, with your own name and port:
New-NetFirewallRule -DisplayName "My app (TCP 8080)" -Direction Inbound -Protocol TCP -LocalPort 8080 -Action Allow
The rule applies at once and to every network (Profile: Any). If your program also uses UDP, run the same command again with -Protocol UDP and another name. Several ports at once: -LocalPort 8080,8443; a range: -LocalPort 27015-27030.
Check It
Start your program and connect to it from your own computer, for example http://YOUR.SERVER.IP:8080. If it does not answer, check on the server that the program really waits on that port:
Get-NetTCPConnection -LocalPort 8080 -State Listen
No line means that the program is not running or uses another port. 127.0.0.1 in LocalAddress means that it accepts only connections from the server itself: change the program's setting to listen on all addresses (0.0.0.0).
Only Your Addresses
If only you or a few computers need the program, allow only their addresses:
Set-NetFirewallRule -DisplayName "My app (TCP 8080)" -RemoteAddress 203.0.113.10
Close the Port Again
Remove-NetFirewallRule -DisplayName "My app (TCP 8080)"
You can see and edit all rules in Windows key + R → wf.msc → Inbound Rules. Your rule is listed under its name.
