Connecting to Visual Studio debugging IIS Express server over the lan

Except to modify the iisexpress configuration file, sometimes you also need to run the command like below.

netsh http add urlacl url=http://*:49419/ user=Everyone


VisualStudio 2015 Non-Admin

  1. In your solution dir, in the file .vs\config\applicationHost.config change the line

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

    to

    <binding protocol="http" bindingInformation=":44302:" />

    (where 44302 is your port)


  1. From an admin command prompt:

    i. Enable non-admin to bind to port

    netsh http add urlacl url=http://*:44302/ user=Everyone

    ii. Allow through firewall

    netsh advfirewall firewall add rule name="IISExpress visualstudio app" protocol=tcp localport=44302 dir=in action=allow


  1. Start debugging from VisualStudio

Update

I made a video that better describes the process, https://youtu.be/5ZqDuvTqQVs

If you are using Visual Studio 2013 or above, make sure you run it as an administrator for this to work.


Open the %USERPROFILE%\My Documents\IISExpress\config\applicationhost.config (in VS2015 it may be $(solutionDir)\.vs\config\applicationhost.config) file. Inside you should see something like this:
<site name="WebSite1" id="1" serverAutoStart="true">
    <application path="/">
        <virtualDirectory path="/" physicalPath="%IIS_SITES_HOME%\WebSite1" />
    </application>
    <bindings>
        <binding protocol="http" bindingInformation="*:8080:localhost" />
    </bindings>
</site>

Change the bindingInformation=":8080:localhost" to bindingInformation="*:8080:*" (the port number, 8080 in my case, will differ.)

Note: If it does not work try with bindingInformation="*:8080: the asterix can be removed.

Then make sure your firewall is allowing incoming connections on that port. You may need to restart the system or at least Visual Studio to get IISExpress to reload the config file.

If this doesn't work, take a look at this answer: https://stackoverflow.com/a/5186680/985284