Pregunta

We have an app deployed as a hosted service on Azure. If we deploy the service specifying that we want 10 instances it will create 10 virtual machines that host the app. My question is if in the code of the app I reference System.Environment.MachineName am I guaranteed to have a unique Machine Name for each instance the app is running? So, in theory if I had a page that simply displayed the System.Environment.MachineName every time it was hit, eventually would I see 10 different machine names? Since you can obviously have multiple virtual machines running on the same box, I wasn't sure if technically you could have two instances on the same physical hardware and if you did, would both of those return the same System.Environment.MachineName? Or is System.Environment.MachineName unique across virtual machines on the same box.

If I'm not guaranteed 10 unique names, is there any piece of data I could get from the code that would identify the instance uniquely enough so that I could identify when all 10 instances of my app have been hit?

¿Fue útil?

Solución

The below identifier unique for each deployment of the role, check if this helps

http://msdn.microsoft.com/en-us/library/microsoft.windowsazure.serviceruntime.roleenvironment.deploymentid.aspx

Otros consejos

Are we talking Web / Worker Roles hosted in a cloud service? If so, you can use the RoleEnvironment class to obtain these details: http://msdn.microsoft.com/en-us/library/microsoft.windowsazure.serviceruntime.roleenvironment.aspx

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top