0

Hi guys i'm stuck with my web api. i hosted my api locally on my computer. if i request using localhost e.g http://localhost:85/api/user/getallusers it works fine.

see this image

but if i use the my local ip e.g. http://192.168.43.86:85/api/user/getallusers it returns "ERR_CONNECTION_REFUSED".

see this image using locally assigned ip

see my ipconfig result

any idea? thank you...

1 Answers1

0

From this link,you can see rsplak says When you access localhost, your /etc/hosts file will tell your computer not to look any further and redirects you to your own computer. When you access the local IP adress, your computer will ask the router to fetch the data, and your router will then point back to your computer.

So it means the mapping of localhost maybe wrong in localhost(it maybe 127.0.0.1 by default). You can change it in C:\WINDOWS\system32\drivers\etc\hosts.Change the IP to your 192.168.43.86.

Yiyi You
  • 16,875
  • 1
  • 10
  • 22