Question

When deploying multi-instance WebRole to Windows Azure Emulator, the Emulator is running multiple IIS Express instances of the WebRole, each one on a reserved local IP, like:

 127.255.0.1
 127.255.0.2
 127.255.0.3

The problem is that i want to access the WebRole as if it was really deployed on Azure, i need to check that Session State is persisted between instances.

Since my Session Id is stored on a cookie, each time i'm connecting to a different instance i need to manually 'inject' the cookie to the request to check session data (since the browser considers the IP of the next instance as different domain).

Is there a way i can use a hostname (on a Windows 7 machine) that will point itself randomally to one of those IP?

Was it helpful?

Solution

Well, apparently the emulator does load balance all request between instances:

Clicking 'Debug' on the Cloud Project will open a web page with an IP that is the virtual Load Balancer (usually 127.0.0.1:80 if not taken already).

Yet, there were 2 things that misled me in the first place:

  • 1. The list of multliple IIS Express instances each with it's own binding (image attached).

enter image description here

  • 2. Implicit Affinity:

    I made the my web application output the instance-id and kept getting the same instance-id all the time. the reason for that is (i guess) the affinity that the emulator enforce (probably using cookie comparison).

Conclusion:

If you want to manually load balance or to control the affinity yourself, you can leverage IIS Server Farming capabilities (as i did eventually) to emulate load balancing.

(Apache/Nginx as some kind of 'Reverse Proxy' is also a good option, but i preferred to stick with products that are already installed and in-use).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top