My Technical Notes

Tuesday, 2 September 2014

Accessing Visual Studio 2013 Web Server (IISExpress) remotely

Visual Studio 2013 now uses IISExpress when it hosts web applications which are being debugged.

Here are the instructions from Giles Middleton's guide, which I have made minor changes. Following are the steps to apply, with your computer name replacing `comp_name` and your Visual Studio port number to replace `49845`.

1. Run the following command (in cmd.exe) as Administrator:

netsh http add urlacl url=http://comp_name:49845/ user=everyone

2. Open up `My Documents\IISExpress\config\applicationhost.config`. This file contains the host headers for all your projects. For your specific project, copy the binding element and paste it underneath it with the `localhost` replaced with `comp_name`. So from:

<binding protocol="http" bindingInformation="*:49845:localhost" />

<binding protocol="http" bindingInformation="*:49845:localhost" />
<binding protocol="http" bindingInformation="*:49845:comp_name" />

Now you should be able to use `http://comp_name:49845` remotely (after restarting IISExpress).

3. One final step is to remove the `urlacl` when we are done:

netsh http delete urlacl url=http://comp_name:49845/

4. Lastly, for the sake of completeness, I have included the instructions on opening the port `49845` in the Windows Firewall (which I did not have to do, because I don't use it):

  • Go to the Windows Firewall with Advanced Security panel
  • Create a new inbound rule.
  • Click ‘Port’.
  • Click ‘Next’.
  • Click TCP.
  • Enter a specific port `49845`.
  • Click ‘Next’.
  • Click ‘Allow the connection’.
  • Click ‘Next’.
  • Click ‘Next’ (you could untick Public).
  • Give it a name `My Web App` and press Finish.

No comments: