An InstanceCount of -1 makes sense only for stateless services running on a multi-machine cluster. In this case, each node runs on its own computer, so you do not have port conflicts, and you can configure the Azure load balancer to loop traffic through the machines that host these instances.
In the local cluster, all nodes are on the same machine, so if they try to use a common HTTP prefix, they really conflict. To avoid this, simply install InstanceCount for your non-state 1 services for on-premises deployments.
All this is required only when you want to communicate with your services using a predefined port. If you do not specify a port in the service manifest, the platform will automatically assign it when the service starts. However, clients must dynamically open your endpoints using platform name resolution APIs, which is often undesirable.
As a result, a common pattern is to listen on a pre-assigned port before your application, and then perform name resolution to forward requests to other services. These second-tier services can listen on a port dynamically assigned by the platform.
source share