I created a simple Web App with a Rest API with C# and VS2015. The web app is running in http://localhost:1623
and it works fine.
Now I'm testing the Rest API doing a POST with Postman
, my url is for example http://localhost:1623/api/foo/bar
with a header Content-Type: application/json
. Everything works great, I get the response correctly.
The local IP address of my PC is 192.168.0.174
, so I change the url to http://192.168.0.174:1623/api/foo/bar
and now I get HTTP Error 400. The request hostname is invalid
, why? Shouldn't it be the same?. The same happens (I get exactly the same error) if I try to access my Web App using 192.168.0.174:1623
instead of http://localhost:1623
in my browser:
I get the same error when trying to use the API from some device other device in my LAN using my IP. I need to use the IP because I need to access it from my network, why doesn't it work, what am I missing? I tried this and this with no success.