Hi,
I'm Pedro A, Independent Advisor
Do you use any other antivirus protection or just Windows Defender?
Initially perform this procedure to restore Windows Defender Firewall settings
In the start menu, type CMD and choose the option "Run as Administrator"
When opening the Command Prompt, type:
netsh advfirewall reset
Then restart your Windows and take a test
If the problem persists, access the event log and verify the reason.
Event Viewer > Applications and Services logs > Microsoft > Windows > Windows Defender > Operational