This is a useful little tidbit of knowledge to have. Suppose you can browse to your new spanky site using IISExpress at http://localhost:54275/ … now you want to look at it on your phone? Or your laptop? Or your … you get the picture …
Pre Visual Studio 2015
- Open up C:\Users\<yourname>\Documents\IISExpress\config\applicationhost.config
- Find your site definition and add in a new binding <binding protocol=”http” bindingInformation=”*:54275:<your-ip-address>” />
- Open Command Prompt (as admin) netsh http add urlacl url=http://<your-ip-address>:54275/ user=everyone
- Then execute netsh advfirewall firewall add rule name=”IISExpressWeb” dir=in protocol=tcp localport=54275 profile=private remoteip=localsubnet action=allow
- Then point your remote machines to http://<your-ip-address>:54275
- Voila!
That wasn’t so hard eh!
Visual Studio 2015
You need to complete steps 2 to 5 above, but Visual Studio 2015 by default doesn’t use the global configuration file for these IISExpress bindings. In order to configure this you know have a couple of options.
The first option is to configure your project to use the global configuration files by added this to your *.csproj file:
<UseGlobalApplicationHostFile>True</UseGlobalApplicationHostFile>
Or you can add your addition bindings to the solution specific configuration file Visual Studio 2015 generates here:
<solution_dir>\.vs\config\applicationhost.config
Now running your solution under Visual Studio 2015 will behave as required.
Potential Errors
There are obviously too many potential errors to keep track of on a single blog post but I thought I’d detail a few fixes to issues I’ve personally experienced.
Access Denied
sometimes you may see this message when trying to launch your solution in Visual Studio. To get around this close everything down and re-launch Visual Studio “as admin”. This should fix the issue and then subsequent launches should work without running Visual Studio as an admin.
Failed to register URL "http://192.168.0.8:51258/" for site "<name>" application "/"
Error Description: The Network location cannot be reached.
This was a particularly annoying issue and took quite some time to track down. It seems that the Threshold 2 update to Windows 10 removed all my listening IP address entries! You can check that by executing this command in a Command Window:
netsh http show iplisten
If your own IP address isn’t listed here you need to add it. You can do that by using this command (use your own IP address obviously):
netsh http add iplisten 192.168.0.8
You can see more information about netsh here.
This is a useful little tidbit of knowledge to have. Suppose you can browse to your new spanky site using IISExpress at http://localhost:54275/ … now you want to look at it on your phone? Or your laptop? Or your … you get the picture …
Pre Visual Studio 2015
That wasn’t so hard eh!
Visual Studio 2015
You need to complete steps 2 to 5 above, but Visual Studio 2015 by default doesn’t use the global configuration file for these IISExpress bindings. In order to configure this you know have a couple of options.
The first option is to configure your project to use the global configuration files by added this to your *.csproj file:
Or you can add your addition bindings to the solution specific configuration file Visual Studio 2015 generates here:
Now running your solution under Visual Studio 2015 will behave as required.
Potential Errors
There are obviously too many potential errors to keep track of on a single blog post but I thought I’d detail a few fixes to issues I’ve personally experienced.
sometimes you may see this message when trying to launch your solution in Visual Studio. To get around this close everything down and re-launch Visual Studio “as admin”. This should fix the issue and then subsequent launches should work without running Visual Studio as an admin.
This was a particularly annoying issue and took quite some time to track down. It seems that the Threshold 2 update to Windows 10 removed all my listening IP address entries! You can check that by executing this command in a Command Window:
If your own IP address isn’t listed here you need to add it. You can do that by using this command (use your own IP address obviously):
You can see more information about netsh here.