Under “Sites” on the left, choose the website you want the port to be changed. On the right in the column “Actions“, under “Edit Site” choose “Bindings…“
Choose the port and then select “Edit…“
Enter the port you want to use (In my case 7878). Check if the port is free.
After the port is changed, we have to open the port on our server machine. Open “Windows Defender Firewall”. You can do this via Windows Search or from Control Panel.
In the left column choose “Advanced settings“
Then again in the left column choose “Inbound Rules“.
On the right column, under “Actions“, click on “New Rule…“
When the Wizard window pops up, choose “Port” as I show on the picture. Then click on “Next >“
Then choose “TCP“, then choose “Specific Local Ports” and write the port you’ve used on “Step 3“. Just as the picture shows.
Choose “Allow the connection“.
Choose which groups in your network will have access to this rule (they will have permission to visit this port / your website).
Choose a name for your rule (better management).
Ready to work. Restart of the IIS services might be required for the changes to work.