There are many reasons for this problem; one of the reasons is that Windows Update failed to install or update the Network drivers, in that case, you have to update the required driver manually.
The localhost connection is refused when the application inside WSL is not running, is listening only on a specific interface instead of all interfaces, or WSL’s localhost forwarding feature is not ...