Remotely accessing the Windows Azure Compute Emulator

We tend to use virtual machines from the modern.ie site to do browser compatibility tests and most of the time it’s sufficient to deploy to a Cloud Service we use for testing (eg: myapp-test.cloudapp.net). But a few days ago we were faced with a compatibility issue where we needed a way to quickly test our changes. With the Internet Explorer Developer Tools (F12) we weren’t able to reproduce the issue, and redeploying the application after each small change would be time consuming.

That’s why we wanted to test the site from a modern.ie virtual machine, while running the application in the Windows Azure Compute Emulator:

When I start the emulator on my workstation it runs on http://127.0.0.1:81 . But when I tried to access the emulator from my virtual machine (through http://192.168.137.1:81), it did not work. This is because the emulator configures IIS Express to only listen on the localhost.

Setting up remote access

The easiest way to enable remote access to the compute emulator is by setting up port forwarding, which is one of the standard features of Windows (through the netsh.exe tool for example). But before we can setup the port forwarding we need to know where it should point to. The easiest way to do this is by running your application in the emulator and then right clicking the IIS Express tray icon:

So on my machine the Compute Emulator runs on http://127.255.0.0:82 (even though I’m accessing it through my browser using http://127.0.0.1:81). This is where I’ll want to point the port forwarding to. The only thing I need to do now is pick a port, open it in the firewall and set up the port forwarding (I’ll be using port 800).

Now simply start an elevated command prompt and execute the following command:

netsh interface portproxy add v4tov4 listenport=800 connectaddress=127.255.0.0 connectport=82 protocol=tcp

This command will redirect all incoming traffic on port 800 to 127.255.0.0. Now from my virtual machine (or any other network location), I’m able to access the application running in the Compute Emulator:

Now if you’re still not able to connect I would suggest completely turning off the Windows Firewall and troubleshoot from there (the most probable cause would be that the port is not open for Public networks).

Enjoy

About Sandrino Di Mattia

Sandrino Di Mattia is a Windows Azure Consultant at RealDolmen and a Windows Azure Insider. He lives and breathes Windows Azure.

  • Vicenç García-Altés

    Thank you very much Sandrino!