What's a possible way to determine on an Azure website with multiple instances what instance is responding (some ID or other piece of unique info)?
6 Answers
The following environment setting will have the instance id the current request is running on: WEBSITE_INSTANCE_ID.
You'll also receive this id as a cookie in the response named: ARRAffinity.
You can also use this information to get back to that specific instance, see: http://blog.amitapple.com/post/2014/03/access-specific-instance/ for more information about it.
Microsoft Azure provides many environment variables for Azure Web Apps (formerly known as Website), including the following:
WEBSITE_SITE_NAME
- the name of the site.WEBSITE_INSTANCE_ID
- the id representing the VM that the site is running on.etc
See Azure Runtime Environment by David Ebbo for more details.
Set up InstanceInputEndpoint
in configuration. This will allocate ports from the given port range for each instance, then you can visit a instance through the port.
For more information about InstanceInputEndpoint
: http://msdn.microsoft.com/en-us/library/windowsazure/gg557553.aspx