This error can happen when you share the printer.
In this case, you need to check whether the firewall service is running. To do this, click Win+R and enter services.msc. In the open window, find the Windows Firewall and click "Run" in its properties if its status is "Stopped". If the button is inactive, first set the service start type to "Automatic" or "Manual."
Once you open the share of the printer, it can be stopped.