Skip to content

access from another machine

Dan Ludwig edited this page Feb 26, 2012 · 1 revision

Extra Credit: Access from another machine

To test UCosmic web elements on phones and tablet devices such as the iPad, it is helpful to connect to the IIS Express instance running on your development machine. Scott Hanselman mentioned this in his Ninja Way article, but since UCosmic does not use a computer name as the host, the setup is slightly different.

Open up the firewall

This step is exactly like in Scott's article. Run this command:

netsh firewall add portopening TCP 80 IISExpressWeb enable ALL

You will see a message that the command is deprecated, but it still works for now. If you want to do it the right way, there are some comments in Scott's article about the appropriate netsh advfirewall command.

Find your IP address

Being the happy program-from-home developer that I am, my wireless router uses a 192.168.1.* DHCP setup. Your network may differ, but either way you need to find out what IP address is assigned to your machine. I do this with the command ipconfig /all. Scroll up after running it and look for the "IPv4 Address". Today, mine is 192.168.1.113(preferred).

Note that if your computer's IP is dynamically assigned, it may change. If it does, come back to this page and follow the steps again to reconfigure remote access for your new IP.

IIS Express Bindings

Open up your IIS Express applicationhost.config file, and add 2 new entries. Change the IP's below to match your machine's IP address.

<bindings>
    <binding protocol="http" bindingInformation="*:1976:localhost" />
    <binding protocol="https" bindingInformation="*:44376:localhost" />
    <binding protocol="http" bindingInformation="*:80:develop.ucosmic.com" />
    <binding protocol="https" bindingInformation="*:443:develop.ucosmic.com" />
    <binding protocol="http" bindingInformation="*:80:192.168.1.113" />
    <binding protocol="https" bindingInformation="*:443:192.168.1.113" />
</bindings>

Running as non-administrator

Remember, this will be sufficient if you run Visual Studio and/or IIS Express as administrator. However to enable this entry for non-privileged users, you need to add 2 new urlacl entries (again, using your own IP):

netsh http add urlacl url=http://192.168.1.113:80/ user=everyone
netsh http add urlacl url=https://192.168.1.113:443/ user=everyone

When your IP address changes, you can remove these with the following:

netsh http delete urlacl url=http://192.168.1.113:80/
netsh http delete urlacl url=https://192.168.1.113:443/

Access from a network that can resolve your IP address

An iPad will not have a host entry for develop.ucosmic.com. However if your iPad is running on WiFi from the same network as your development machine, you can access it using the IP address. In my case, I open Safari in the iPad and navigate to the address http://192.168.1.113. I can now write code on my workstation, and see those changes immediately by hitting the iPad Safari refresh icon. Enjoy!

<< Back: Advanced IIS Express SSL & host name setup | Next: Before you run any unit tests >>