The first time I created an Azure Service Fabric cluster, there was one very importing thing I forgot to configure; custom endpoints.
Custom endpoints allow you to expose a stateless or statefull service to the outside world. Without this the service is only accessible from inside the datacenter. The annoying thing is that you can only set the custom endpoints when you create your cluster. I couldn’t find a way to change this after the cluster is created. This means that if you forget to add a port, you have to recreate your cluster from scratch.
My current solution is to preconfigure a range of ports so I don’t run out of available endpoints while developing. To use one of the available endpoints, you have to configure the port you want to use in the ServiceManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<ServiceManifest Name="SampleService"
Version="1.0.0"
xmlns="http://schemas.microsoft.com/2011/01/fabric"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ServiceTypes>
<!-- This is the name of your ServiceType.
This name must match the string used in RegisterServiceType call in Program.cs. -->
<StatelessServiceType ServiceTypeName="SampleComponentType" />
</ServiceTypes><!—Some content removed—>
<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="9003" />
</Endpoints>
</Resources>
</ServiceManifest>