I'm new to docker and I have a visual studio solution with 2 dotnet core projects - UI and API. I've added docker support for both projects and they worked normally anytime I debug. Now they have an http client to call the api from the web and it suddenly starts giving the "Cannot assign requested address" error.
The weird thing here is that this error only comes up from just one PC. I have a second PC that still runs the projects smoothly. None of the other team members sees this error.
I've pruned all containers and images but that didn't help. I'm not using docker-compose so the answers I found on related questions can't work for me.
The article here explains how localhost is being interpreted differently in docker but I'm not sure how to make his solution work for me.
The fact that this issue doesn't occur on other PCs is what really baffles me here.
Note: I'm not sure what part of the code I need to share because I don't know what's relevant to this problem.
I had the same problem when creating a client using the localhost
url. I replaced http://localhost:5001
with http://host.docker.internal:5001
and it worked.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With