Run .Net core application inside a docker

Changing the urls settings did the trick for me:
In hosting.json:

{
    "urls": "http://*:5000/;"
}
``
FYI: I had the same error with `localhost` and after I changed it to `127.0.0.1` the error was not logged anymore - however I could still not connect until I set the host to `*`.
I think the host part of the urls restricts how the server is accessed, and since you are not accessing the server from within the docker container `127.0.0.1` will not work.