0

Working in visual studios and I created a rest API.

When I click run on the project it binds to localhost. Can someone point me in the right direction on how to bind to 0.0.0.0 so that my API can be accessed from outside my computer so that I may do some testing on my services externally using my computers IP address on the network?

Question

How do I bind my visual studio service to my computers IP address and not localhost?

Tony
  • 859
  • 1
  • 7
  • 19
  • localhost is 0.0.0.0 https://en.m.wikipedia.org/wiki/0.0.0.0 – Linda Lawton - DaImTo May 14 '18 at 14:38
  • thanks for the comment, I understand that I need to bind to 0.0.0.0, but how to achieve this in in visual studio for my service – Tony May 14 '18 at 14:42
  • The technologies in use are more relevant than Visual Studio. Is this WCF? ServiceStack? Web API? How are you hosting? Owin? IIS? –  May 14 '18 at 15:01
  • Hi Amy, I'm hosting on my local machine, It's an Web API. Running in from visual studios using IIS Express. – Tony May 14 '18 at 15:04
  • If you want it reachable by other machines, don't run it inside VS. Host it properly in IIS. IIS Express will allow this, you just need the IP/port. –  May 14 '18 at 15:04
  • Look at this question: https://stackoverflow.com/questions/3313616/iis-express-enable-external-request?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa – Icemanind May 14 '18 at 15:05
  • Thanks, @Amy I ended up running it as an IIS service on my machine instead of an IIS Express – Tony May 14 '18 at 15:13
  • I tried to configure it using your post @Icemanind it didn't work. – Tony May 14 '18 at 15:13

1 Answers1

1

I'm guessing you're probably using IISExpress since that's the VS default, which won't let you connect from other computers.

You could consider using a proxy tool like ngrok to allow remote access : https://ngrok.com/

Or consider changing to use IIS which you'll be able to configure as you need.

Sam
  • 1,208
  • 1
  • 9
  • 16