Dunken
Dunken

Reputation: 8681

ASP.NET Web API listens on 0.0.0.0 instead 127.0.0.1

My ASP.NET Web API is bound to localhost:

startOptions.Urls.Add("http://localhost:8080");

If I now call netstat -a I would have expected to see something like 127.0.0.1:8080 but it looks like my binding works on all IP addresses on the local machine:

Active Connections

  Proto  Local Address          Foreign Address        State
  TCP    0.0.0.0:8080           MyComputer:0            LISTENING
  TCP    [::]:8888              MyComputer:0            LISTENING

Do I have to worry about external (e.g. non-localhost) connections?

Upvotes: 4

Views: 2875

Answers (2)

M3TATR0N
M3TATR0N

Reputation: 1

0.0.0.0:8080 is also a DroidScript address used for "no touch" mobile phone "hacking" it is not solely limited to DroidScript as many users of JS use it across a wide variety of web tools

Upvotes: 0

"Yes", since this port may be routable by others you may need to worry about external connections, but it depends on your specific environment. Use the https://en.wikipedia.org/wiki/Localhost loop back address, 127.0.0.1 and then you won't have to have external access concerns:

startOptions.Urls.Add("http://127.0.0.1:8080");

Your question has to do with the default route, https://en.wikipedia.org/wiki/Default_route.

FYI: You may want to have a configuration that switches this when you deploy so it can have access when you want it to...

Additionally, https://ifconfig.co/port/8080 may be able to help you determine if your port is exposed...

Upvotes: 2

Related Questions