-1

基本上我希望能够从辅助副本中读取。因此,我尝试在只读侦听器上添加另一个带有 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);
}
4

1 回答 1

1

仅使用第二个侦听器。创建 ServiceProxy 时,指定要与之通信的目标副本。这是 Create 方法中的一个参数。

在您提到的那个示例中,它们使用两个特定端点,一个启用与辅助副本通信,一个未启用。

于 2017-02-10T06:03:34.067 回答