Failed to bind to address (already in use) error with Visual Studio Mac API
Solution 1:
Sure you can change the port every time you get that error or even restart your computer, here is the correct way to go about this
Find what is running on that port and kill the process
Terminal on mac
find the process number
lsof -i: <port number>
eg lsof -i:5001
Then kill the process number
kill -9 <process number>
eg - kill -9 1600
Solution 2:
I know this is late answer. But it may be helpful to somebody.
There seems a bug with MAC Visual Studio, it always goes https://127.0.0.1/5001.
If you right click on your project, select options. Then Project Options Dialog will appear. On the left pane, goto Run->Configurations->Default, then on the right pane select ASP.Net Core tab. There is App URL which is being used by default. Change it to your needs.
Solution 3:
Assuming that you are using default port:
this usually happens when a process gets corrupt and is disconnected from visual studio.
If you are on mac, open activity monitor and kill the process by name "dotnet"
If you are using a non standard port: then you need to change the port number to an available one. There is a solution from Amit on this thread, use that to change the port.