【问题标题】:Service Fabric application instance configurationService Fabric 应用程序实例配置
【发布时间】:2017-10-01 09:55:15
【问题描述】:

您如何配置不同的应用程序实例?我知道您可以参数化ApplicationManifest 和服务Config 包,但是如何在两个不同的应用程序实例中为Web 服务指定不同的端口? webservice 的端点在ServiceManifest 中定义,无法参数化 afaik。

<Resources>
  <Endpoints>
    <!-- This endpoint is used by the communication listener to obtain the port on which to 
           listen. Please note that if your service is partitioned, this port is shared with 
           replicas of different partitions that are placed in your code. -->
    <Endpoint Protocol="http" Name="ServiceEndpoint" Type="Input" Port="80" />
  </Endpoints>
</Resources>

假设我有一个应用程序类型MyAppType,其中包含一个服务类型MyWebSvcType。我创建了应用程序类型MyAppTenant1MyAppTenant2 的两个实例。如何指定MyAppTenant1的webservice监听80端口,MyAppTenant2的webservice监听81端口。这是因为它们可能在同一个节点上,因此应该监听不同的端口。

【问题讨论】:

    标签: .net web-services azure-service-fabric


    【解决方案1】:

    如果您省略 Port 属性,您的服务实例将获得分配的动态端口。您可以使用code 找到服务端点,也可以通过内置的反向代理访问它。

    更多信息herehere

    【讨论】:

    • 我尝试了您关于使用反向代理的建议。但是,它似乎总是将我的请求发送到第一个应用程序实例,无论我在 URL 中输入的应用程序名称(例如“mycluster:19008/PartitionTestGreen/WebSvc/api/Values/10”)仍然将我发送到 PartitionTestYellow 应用程序实例而不是 PartitionTestGreen 实例。
    • 我不需要在反向代理本身上配置任何东西?它已启用(在门户中显示为已启用)并且它清楚地将所有应用程序实例的请求转发到错误的实例(始终相同)。
    • 我自己没有遇到过这个问题,它对我来说很好。无需额外配置。您可以运行列出端点的代码 sn-p 来查看是否所有端点都与您期望的一样吗?
    猜你喜欢
    • 2017-10-16
    • 2017-09-03
    • 2018-10-19
    • 1970-01-01
    • 2016-09-20
    • 2016-05-02
    • 2019-04-25
    • 2020-01-29
    • 2016-11-23
    相关资源
    最近更新 更多