Question: 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](https://medium.com/it-dead-inside/docker-containers-and-localhost-cannot-assign-requested-address-6ac7bc0d042b) 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.

Answer: 
I had the same problem when I was creating the client using the `localhost` url. I replaced `http://localhost:5001` with `http://host.docker.internal:5001` and it worked.
If you use docker-compose you can use the name of the service in your compose.yml as the host name, for example:

```
docker-compose.yml:
services:
  webapi1:
    ...
  eventmanager:
    ...

```

You can request your second container within the docker network as:

```
using var client = new RestClient("http://eventmanager");

```