Fixing `failed to bind to address https://localhost:xxxx

Fixing `failed to bind to address https://localhost:xxxx
Photo by Ruth Bourke / Unsplash

Randomly get this error when running code from VS2026 and every time I forget how to fix it and have to search and dig around until I find the right answer - it's nearly always to do with restarting a service but which one??

So I thought I should add it to my blog as a reminder to myself (if I remember that I've added it)

net stop winnat
net start winnat

Maybe I'll come across this when searching or it may help somebody else.