How your web site binding works when Windows Azure webrole runs in Compute Emulator?

 When you run your web role (ASP.NET Web site) in compute emulator (development fabric), you will see following things happens in your machine while running your website:

 

  • A listener is created so you can access your site at https://127.0.0.1:81 (Port and IP address could change for multiple roles and instances)
  • Looking into IIS you will see the web site has a binding to some arbitrary port number (mostly 5121 or some port number closer to it).
  • In compute emulator, emulated load balancer listens on your web site port (in this case #81) and forwards traffic to all instances in your web role
  • Emulated load balancer forwards all the requests to your web site binding port number (in this case 5121).
  • Compute emulator is configured to only listen on loopback.
  • Because compute emulator is configured to only listen loopback address, requests from a different host could not being forwarded.
  • Means, if you create an arbitrary DNS name in your hosts file that maps to your loopback address, you wouldn’t be able to hit your site on port 81.
  • To solve above behavior, you can use a port forwarder.