I have setup my servicefabric Stateful service to use two listener endpoints
My CreateServiceReplicaListerners()
looks like this -
return new[]
{
new ServiceReplicaListener((c) => new FabricTransportServiceRemotingListener(c, this),
"dataServiceRemotingListener"),
new ServiceReplicaListener((context) =>
new WcfCommunicationListener<IReferenceDataService>(
wcfServiceObject:this,
serviceContext:context,
//
// The name of the endpoint configured in the ServiceManifest under the Endpoints section
// that identifies the endpoint that the WCF ServiceHost should listen on.
//
endpointResourceName: "WcfDataServiceEndpoint",
//
// Populate the binding information that you want the service to use.
//
listenerBinding: WcfUtility.CreateTcpListenerBinding()
), "dataServiceWCFListener")
};
However,on testing I found that only one endpoint works. To be specific, only the one registered first works. In the above case, Service Remoting worked but the WCF listener didnt. In my client that was trying to make wcf call, I kept getting error - The provided URI scheme 'localhost' is invalid; expected 'net.tcp'.
When the change the order in which they are registered, then the WCF remoting works but SeviceRemoting doesn't. This looks like a bug, not sure if anyone faced similar issue?
Please advise.
Update:
Here is my client side details
_service = serviceProxyFactory.CreateServiceProxy<IReferenceDataService>(
new Uri("fabric:/DataService/ReferenceDataService"),
new ServicePartitionKey(0));
Specify the listener name, when creating the proxy.
var proxy = _serviceProxyFactory.CreateServiceProxy<IMyService>(MyServiceUri, new ServicePartitionKey(partitionKey), TargetReplicaSelector.PrimaryReplica, "dataServiceRemotingListener");
If you omit the name, the first endpoint will be used. Depending on the order you return the listeners, remoting will work or not.
Also, make sure you declare 2 endpoints in the service manifest.