Setup remote access to IISExpress visual studio on LAN

Many times you might need to access your under development site on other computer of your local network. I mostly required this thing to debug my application on mobile devices or webview mobile apps.

Main problem that one face to access under development site on other network computers that their development web server is IIS Express which doesn’t allows access to remote computers to your site.

I think I should mention here that I am talking about developers working on Visual Studio.

So for doing this on my machine I searched for solution and found some which didn’t worked for me but later when I did hit and trial with those solutions I got this working for me. So for other developers who might be facing similar situations I am wroting this article to follow these steps to access IIS Express site on remote computer.

Step 1 – Run command prompt as administrator (yeah you read it right, you need administrator permissions to run this command) and run below command:

netsh http add urlacl url=http://edunyte/ user=everyone

Not to mention that you have specify your application url in place of http://edunyte/ in above command. This url could be anything like your system name (like we have placed above) or you system IP address like http://192.168.1.10/. You also have to specify the port in above command if your application is not running on default http port that is port 80.

Here is one sample of command if you are using IP and any port other then default http port:

netsh http add urlacl url=http://192.168.1.10:8080/ user=everyone

You an also specify the user name our user group to which you want to give access to this site remotely, for this you have to specify the user or user group name in place of everyone in above command. See the example below:

netsh http add urlacl url=http://edunyte:8080/ user=dilip

If you want to remove any previously added url just run below command by replacing our url with your (as explained above)

netsh http delete urlacl url=http://edunyte:8080/

Step 2 – Open applicationhost.config file from Documents/IISExpress/config and replace

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

with

<binding protocol="http" bindingInformation="*:8080:edunyte" />

or

<binding protocol="http" bindingInformation="*:8080:192.168.1.10" />

Use any option from above two based on you are using IP or system name for your site

Step 3 – In Visual Studio go to your project properties, select web and change project url from http://localhost:8080/ to http://dilip-pc:8080/ or http://192.168.1.10:8080/ (use name method which you used for binding in applicationhost.config and to register url through cmd)

Step 4 – This is a not to miss step you you have firewall on your development machine. Add inbound rule to allow incoming connection on your application port (in our case it is 8080). After adding this firewall rule only you can access your application on remote system.

Step 5 – Stop IIS Express by right click on tray icon and selecting exit. Now run you application in visual studio and try to open it on other system on network. For this just type your application url as http://edunyte:8080/ or http://192.168.1.10:8080/ (again this url depends on you configuration above).

Frankly speaking I was not able to access my IIS Express site on my mobile device using machine name so I am using it though IP right now. But actually same procedure should work for both that is IP and machine name.

Leave a Reply

Your email address will not be published.