Accessing an IIS Express site from a remote computer

From Logic Wiki
Jump to: navigation, search


Bind your application to your public IP address

Go to this file

/{project folder}/.vs/config/applicationhost.config

You will find something like this:

<site name="Alpha.Web" id="2">
    <application path="/">
        <virtualDirectory path="/" physicalPath="C:\Users\Johan\HgReps\Alpha\Alpha.Web" />
    </application>
    <bindings>
        <binding protocol="http" bindingInformation="*:58938:localhost" />
    </bindings>
</site>

In <bindings>, add another row:

 <binding protocol="http" bindingInformation="*:58938:192.168.1.42" /> 

(But with your IP, and port number, of course)

Allow incoming connections

First, start an administrative command prompt. Second, run these commands, replacing 192.168.1.42:58938 with whatever IP and port you are using:

 netsh http add urlacl url=http://192.168.1.42:58938/ user=everyone

This just tells http.sys that it’s ok to talk to this url.

 netsh advfirewall firewall add rule name="IISExpressWeb" dir=in protocol=tcp localport=58938 profile=private remoteip=localsubnet action=allow

And there you go, you can now press Ctrl-F5 in Visual Studio, and browse you site from another computer!