Hi Tasneem,
I'm Sumit, here to answer your query at the Microsoft Community.
This problem usually occurs when one of the services is not working properly.
Via
https://support.microsoft.com/en-us/windows/fil...
Turn on network discovery and file and printer sharing, and turn off password protected sharing.
Select the Start button, then select Settings > Network & internet , and on the right side, select Sharing options.
Under Private, select Turn on Network discovery and Turn on file and printer sharing.
Under All Networks, select Turn off password protected sharing.
Make sharing services start automatically.
Press the Windows logo key + R.
In the Run dialog box, type services.msc, and then select OK.
Right-click each of the following services, select Properties, if they're not running, select Start, and next to Startup type, select Automatic:
Function Discovery Provider Host
Function Discovery Resource Publication
SSDP Discovery
UPnP Device Host
Hope that helps, and rely on us for any further inquiries. All the best.