Remote Connections with VS2010

1 min read

From time to time, I find myself needing to connect to a debugging VS website from another machine. Maybe it’s for a demo, maybe for an app, maybe it’s cause I’m running VMWare Fusion & want to debug in Safari.

Back in the Casinni days of VS2008, there was this single line of code in Casinni that rejected outside connections. If you had the stomache for some messy hacking, it was possible to remove this check.

These days, support for outside connections is a bit closer to being practical, yet it’s a mirror maze of steps that you have to piece together based on error messages. Well not anymore. These intructions show you how to take a normal VS2010 website & make it accessible from another computer on your network.

Step 1) Make Sure Your Site Works

When I debug on my website called “TestWeb2”, the url is: http://localhost:52214 & it is working fine.

My computer name is jwrightdesktop. You can find yours by typing ‘hostname’ into the command line.

The goal is to go to another computer on my network and access this webpage at http://jwrightdesktop:52214

Step 2) Use IIS Express

  1. Right-click your web project in VS2010
  2. Click on the ‘Web’ tab
  3. Click “Use Local IIS Web Server”
  4. Click “Use IIS Express”

    Run your website again – nothing should have changed except that you’re on IIS express now.

Step 3) Firewall Exception

This wasn’t a problem for me because my firewall wasn’t blocking it. (our firewall is managed from a different area)

Your firewall likely IS blocking outside connections, so checkout this post for tips on opening it up:

Step 4) Bindings

As it stands, IIS knows it should respond to ‘localhost:52214’. You need to tell it that ‘jwrightdesktop:52214’ is ok too.

Open up your applicationhost.config file found in a directory like: C:UsersjwrightDocumentsIISExpressconfig

Find the bindings for your website. Mine look like this:

<site name="TestWeb2.Web" id="8">
<application path="/" applicationPool="Clr4IntegratedAppPool">
    <virtualDirectory path="/" physicalPath="W:TestWeb2TestWeb2.Web" />
    <binding protocol="http" bindingInformation="*:52214:localhost" />

Just below the first binding, add a line like this:

<binding protocol="http" bindingInformation="*:52214:jwrightdesktop" />

Step 5) Run VS2010 as an Admin

Re-run the site. It should probably be working now. If it’s not, then you might need to be running VS2010 as an admin. For me, that means right-clicking the VS icon and clicking ‘Run as Administrator’.

If you click ‘properties’ instead of ‘Run as Administrator’ then under the ‘Compatibility’ tab you can choose to always run this program as admin.

Other Thoughts

You can do the same thing using your ip address instead.

Here are some of the links I found helpful:

Leave a Reply

Your email address will not be published. Required fields are marked *