Question

I can connect to my Web API app from a browser or from another app (such as a Windows Forms app) by going to:

http://localhost:28642/api/inventoryitems/GetAll

...but how can I make localhost available to others (on the same network) so that they can make these same REST calls?

Is it just a matter of them connecting to my machine, like so:

http://platypus:28642/api/inventoryitems/GetAll

...and if so, what do I have to do to make it accessible (if anything)?

At any rate, I don't really want to have to run my Web API app all the time on my machine, so: How can I set it up so that it will run 24/7 without my having to start/babysit it?

Would an Azure web site be a valid option for this?

UPDATE

It could be (based on what I read here) that changing applicationhost.config from this:

<site name="HandheldServer" id="20">
    <application path="/" applicationPool="Clr4IntegratedAppPool">
        <virtualDirectory path="/"  physicalPath="C:\HandheldServer\HandheldServer" />
    </application>
    <bindings>
      <binding protocol="http" bindingInformation="*:28642:localhost" />
      <binding protocol="http" bindingInformation="*:28642:platypus" />
      <binding protocol="https" bindingInformation="*:44300:localhost" />
    </bindings>
</site>

...to this:

<site name="HandheldServer" id="20">
    <application path="/" applicationPool="Clr4IntegratedAppPool">
        <virtualDirectory path="/" physicalPath="C:\HandheldServer\HandheldServer" />
    </application>
    <bindings>
      <binding protocol="http" bindingInformation="*:28642:localhost" />
      <binding protocol="http" bindingInformation="*:28642:platypus" />
      <binding protocol="http" bindingInformation="*:28642:" />
      <binding protocol="http" bindingInformation=":28642:" />
      <binding protocol="https" bindingInformation="*:44300:localhost" />
    </bindings>
</site>

...will make it available (but, will I have to be running it, or will IISExpress fire it up in the background?)

Presumably, the first entry may already make it available. I don't know if the prepended * is necessary, so I have an entry both with and without that.

Was it helpful?

Solution

You have the choice :

  • buy a Rasperberry Pi in order to have an independant server/service running instead of your machine
  • buy a VPS
  • open the firewall ports on your router
  • use your smartphone (yes it's possible)
  • change your hosts file (windows, linux, mac)

there is no miracle ;)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top