Search code examples
.netweb-servicesazure-service-fabric

Service Fabric application instance configuration


How do you configure different application instances? I know you can parameterize the ApplicationManifest and service Config packages, but how would you specify a different port for the webservice in two different application instances? The endpoint for the webservice is defined in the ServiceManifest, which can not be parameterized 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>

Say I have an Application Type MyAppType which contains a service type MyWebSvcType. I create two instances of the application type MyAppTenant1 and MyAppTenant2. How do I specify that the webservice of MyAppTenant1 listens on port 80 and the webservice of MyAppTenant2 listens on port 81. This is because they could be on the same node, and thus should listen to different ports.


Solution

  • If you omit the Port attribute, your service instance will get a dynamic port assigned. You can find the service endpoints by using code or you can access it through the built in reverse proxy.

    More info here and here.