簡體   English   中英

如何獲取位置(親緣區域)或名稱集群(結構服務)

[英]How to get location(affinity zone) or name cluster(fabric service)

我目前正在使用Fabric服務的Web API。 需要獲取Fabric服務集群的位置(親緣區域)。 即通過Web API中的代碼(c#)確定當前群集位於哪個位置。 否則,我需要托管Web API的群集的名稱。

在webrole或雲服務中,可以使用https://management.core.windows.net/ {0} / services / hostedservices

但是我找不到任何集群方法。

我不確定這是否有幫助,但請查看為項目創建的ServiceEventSource。 ServiceMessage方法向您顯示了很多可從服務上下文中獲得的信息。

ServiceMessage(
    service.Context.ServiceName.ToString(),
    service.Context.ServiceTypeName,
    service.Context.ReplicaId,
    service.Context.PartitionId,
    service.Context.CodePackageActivationContext.ApplicationName,
    service.Context.CodePackageActivationContext.ApplicationTypeName,
    service.Context.NodeContext.NodeName,
    finalMessage);

您還可以查看FabricClient

經過所有的研究,我做到了

<Section Name="Affinity">
    <Parameter Name="Zone" Value="Eusa" />
</Section>

將其添加到PackageRoot>配置>設置中

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM