0

I've got an VS WebApp I am testing (An OData Provider if it matters). The client is Android.

You can't run the server and client (via a simulator of the client' OS) on the same box.

So I'm using a physical Android device to run the client. Unfortunately Visual Studio is hell bent on binding the webapp to (and only to) localhost. It isn't won't respond to attempts to connect to the hostname or IP address, and any attempt to change the IIS configuration inside of Visual Studio meets with an error message saying you specifically must use localhost (which obviously cannot be used to connect to from a another machine)

1) How do I get around this?

and

2) If this isn't obvious to find, how are people are expected to test from a remote device on their development machine?

JoeHz
  • 2,136
  • 1
  • 18
  • 29

1 Answers1

0

JoeHz,

You need to change the binding configuration of your IIS Express for your WebApp.

  • In the folder where your *.sln is, find the hidden folder named .vs. Then open the xml file applicationhost.config in the config folder.
  • In the applicationhost.config file, find the sites nodes, then the site you want to configure.

For example:

 <site name="MySiteName" id="2">
    <application path="/" applicationPool="Clr4IntegratedAppPool">
        <virtualDirectory path="/" physicalPath="C:\MyDirecctory" />
    </application>
    <bindings>
        <binding protocol="http" bindingInformation="*:8381:localhost" />
        <!--Add new binding here with ip address-->
        <binding protocol="http" bindingInformation="*:8381:192.168.0.10" />
        <!--or add new binding with machine name-->
        <binding protocol="http" bindingInformation="*:8381:MachineName" />
    </bindings>
</site>
  • Once the file saved, make sure your IIS Express is closed and start your website. Once IIS Express started, check if the new binding worked, you should see something like this:

IIS Express Extra binding

  • Ensure you can access the website in your web browser, not with localhost, but this time with your new binding like http://192.168.0.56:33617.
  • If all is good, then go to your Firewall, and add a new TCP rule for the port you need to open
  • When done, at that point any device on the same network should be able to access the website. Try the new address on your Android device web browser.
  • Your Android client should now be able to access your WebApp.
Vivien Chevallier
  • 1,492
  • 1
  • 11
  • 14
  • I had already added the bindings into the applicationhost.config in the webapp and have had no luck. I'm trying to do this strictly with Visual Studio because I need the debugging. IISExpress isn't running until I hit the button inside of VS. – JoeHz Nov 13 '16 at 03:17
  • http://stackoverflow.com/questions/3313616/iis-express-enable-external-request seems to tell me how to do this, but results in 503's – JoeHz Nov 13 '16 at 03:34
  • Not with IIS Express, no. IIS Express seems hard wired to use localhost. I believe I will have to use the full IIS. – JoeHz Nov 15 '16 at 01:00
  • Sorry about the delay. Your instructions pretty much worked once I reinstalled Express. No reason behind why it was borked. – JoeHz Dec 09 '16 at 06:06