基本上我希望能够从辅助副本中读取。因此,我尝试在只读侦听器上添加另一个带有 listenerOnSecondary 参数的命名侦听器。但是 SF 在本地部署时无法创建此有状态服务的实例。
protected override IEnumerable<ServiceReplicaListener> CreateServiceReplicaListeners()
{
yield return
new ServiceReplicaListener(context => new FabricTransportServiceRemotingListener(context, this),
"StatefulReadWriteCommunicationListener");
yield return
new ServiceReplicaListener(context => new FabricTransportServiceRemotingListener(context, this),
"StatefulReadOnlyCommunicationListener", listenOnSecondary: true);
}