Long time is passed after my last ‘notable’ blog post, I was just too busy and lazy in the past months, lots of things happened and I couldn’t follow everything, but it’s not that I want to talk about, let’s talk about some more WP7 development.

Actually I am ‘playing’ with WP7, jQuery Mobile, WCF services and some various mobile stuff these days, honestly I was tired of having my WP7 device connected to the USB cable in order to be able to surf websites and use services that are hosted on my development machine. So I started to scouting around looking for a solution.

My goal is to be able to host websites and WCF services using WebMatrix ad IIS Express at first and a custom made WCF self hosting solution at a later time for my developing everyday life (and for demo purposes).

So here’s my current setup:

  • IIS Express/WebMatrix
  • Zune
  • WP7 + USB cable connected
  • a fantastic website hosted on IIS Express

Everything is working correctly here, I can browse the website from WP7 and test it, but I have to keep the cable connected, which is a no go if I want to make a demo of something to someone with a ‘floating’ device. I do not want to create new DNS entries, nor touch the network infrastructure nor do any other complicated IT or network related stuff, that’s not for me.

I want to be able to switch to this setup (both for testing and demo environment):

  • IIS Express/WebMatrix
  • WP7
  • still my fantastic website hosted on IIS Express

you see: no Zune, no cable, just me and my device (and Visual Studio of course). To obtain this we need to make IIS Express able to accept connections from the outside, you can do that following this guide:


Here’s what I had to do in order to make things work:

  • Get your computer IP, mine was:
  • Pickup a port you will use to host your service (using port 80 is bad idea on a development machine), I choose: 24778.
  • Configure HTTP.SYS (the component that is used to handle http requests) to accept external connection when running as standard user (you can bypass this if you launch WebMatrix and IIS Express with admin privileges, but that’s not good for security reasons), open a shell prompt with admin rights and type:

    netsh http add urlacl url= user=everyone

  • Configure the binding in WebMatrix: doing it by manually editing the applicationhost.config file is the best way. The file is located is your user profile at the following folder: “%USERPROFILE%\documents\IISExpress\config”. Another way to find it is: right click on the IIS Express icon in the system Tray, choose “show all applications”, highlight your website and then look at the configuration setting (it’s the last voice on the window), you can even click on it to open the file in notepad.

    The image is in Italian, I know Open-mouthed smile; now that you have your file open you need to locate the your website configuration and change the binding settings to allow connection the pre-defined IP address and port. Here’s how I modified my configuration:

    <site name="MyWonderfulSite" id="2">
     <application path="/">
         <virtualDirectory path="/" physicalPath="D:\XXXXXXXXXX" />
         <binding protocol="http" bindingInformation="*:24778:localhost" />   
         <binding protocol="http" bindingInformation="" />   

    I have added a binding that explicitly configure the IP address and port that I want to use without assigning a hostname.
  • The last step is to open up the port in your Firewall, this is up to you depending on the Firewall you are using.


If you have followed all the steps you are now able to browse your test website (using the specified address like: from your WP7 without having the USB cable connected and Zune open, pretty cool isn’t it ?

These very same steps can be used for your Android and iPhone devices, but I personally do not own any of those devices so I wasn’t able to try it.

Doing this research I’ve learned a couple of things about IIS Express and how the http requests are served by the system.

As last note: to undo the modifications you’ve done to the HTTP.SYS configuration you can use the following command:

netsh http delete urlacl url=


See you next.