if you have a firewall software than this solution is not working because as having two firewall softwares will conflict each other, so to avoid conflicts Windows Firewall will generally turn itself OFF.
But if you are sure that you don’t have any other firewall on the computer then try the following steps:
Check if the windows firewall service is set to automatic
Start -> Run -> type SERVICES.MSC then hit Enter key -> In the Services windows scroll down to findWindows Firewall -> Right Click and click Properties
Set he “Start up type ” to Automatic and not manual
Start -> Run -> type NETSH FIREWALL RESETand hit Enter
Restart the computer