Windows will set different network location when you connect to different AP, if you have used as public network location, the Windows Firewall will limit the connection.
For example, after you change the router, the printer may not work in the same environment; or if you share the files in the LAN before, then cannot access the server anymore.
In general, you can choose the network location when the first time you connect the different Wi-Fi. If you have chosen an incorrect network location, you can refer to below guide to modify the network location on your PC.
For Win 10:
Change the network profile on the Setting-> Network and Internet.
Choose the connection which has been set up, then you will access a window named “Network Profile”, save it as “Private”
For Win 7:
Change the connection type on the Control Panel-> Network and Internet-> Network and Sharing Center. Let it works in the same home group.