任何帮助,我如何才能获得虚拟机的当前状态?
Image http://i59.tinypic.com/213erep.png
我已尝试过这些,但我无法获得示例状态“已停止”。
Console.WriteLine(role.RoleName);
//Console.WriteLine(role.ResourceExtensionReferences[0].State);
//Console.WriteLine(deployment.RoleInstances[0].PowerState);
//Console.WriteLine(client.Deployments.GetBySlot("demovm", DeploymentSlot.Production).Status);
任何线索/想法,我缺少什么?
答案 0 :(得分:2)
您将使用以下内容:
http://msdn.microsoft.com/en-us/library/azure/ee460806.aspx
确保嵌入详细信息为真,您将获得云服务中所有节点的列表。
<RoleInstanceList>
<RoleInstance>
<RoleName>name-of-role</RoleName>
<InstanceName>name-of-role-instance</InstanceName>
<InstanceStatus>status-of-role-instance</InstanceStatus>
<InstanceUpgradeDomain>update-domain-of-role-instance</InstanceUpgradeDomain>
<InstanceFaultDomain>fault-domain-of-role-instance</InstanceFaultDomain>
<InstanceSize>size-of-role-instance</InstanceSize>
<InstanceStateDetails>state-of-role-instance</InstanceStateDetails>
<InstanceErrorCode>error-code-returned-for-role-instance</InstanceErrorCode>
<IpAddress>ip-address-of-role-instance</IpAddress>
<InstanceEndpoints>
<InstanceEndpoint>
<Name>name-of-endpoint</Name>
<Vip>virtual-ip-address-of-instance-endpoint</Vip>
<PublicPort>public-facing-port-of-instance-endpoint</PublicPort>
<LocalPort>internal-facing-port-of-instance-endpoint</LocalPort>
<Protocol>protocol-of-instance-endpoint</Protocol>
</InstanceEndpoint>
</InstanceEndpoints>
<PowerState>state-of-role-instance</PowerState>
<HostName>dns-name-of-service</HostName>
<RemoteAccessCertificateThumbprint>cert-thumbprint-for-remote-access</RemoteAccessCertificateThumbprint>
</RoleInstance>
</RoleInstanceList>
你有&#39; InstanceStatus&#39;和&#39; PowerState&#39;根据您的需求选择。不是最直观的地方我同意。
-matt