我使用开箱即用的分区创建了一个有状态服务:
<StatefulService ServiceTypeName="ExamplesServiceType" TargetReplicaSetSize="[ExamplesService_TargetReplicaSetSize]" MinReplicaSetSize="[ExamplesService_MinReplicaSetSize]">
<UniformInt64Partition PartitionCount="[ExamplesService_PartitionCount]" LowKey="-9223372036854775808" HighKey="9223372036854775807" />
</StatefulService>
服务 list 将参数设置为(开箱即用):
<Parameter Name="ExampleService_PartitionCount" Value="1" />
<Parameter Name="ExampleService_MinReplicaSetSize" Value="2" />
<Parameter Name="ExampleService_TargetReplicaSetSize" Value="3" />
<Parameter Name="WebService_InstanceCount" Value="1" />
现在我想从同一个集群中的无状态服务调用我的有状态服务:
ServiceUriBuilder builder = new ServiceUriBuilder(ExampleServiceName);
var service = ServiceProxy.Create<IExampleService>(builder.ToUri(),new ServicePartitionKey(1));
return service.MyCallAsync(id);
我收到以下错误:
The primary or stateless instance for the partition 'a67f7afa-3370-4e6f-ae7c-15188004bfa1' has invalid address, this means that right address from the replica/instance is not registered in the system
我试图将日志访问到事件日志并且日志带有“partitionId”的有状态服务:“a67f7afa-3370-4e6f-ae7c-15188004bfa1”。
我错过了什么?
最佳答案
对于那些使用 Microsoft.ServiceFabric.Services.Remoting
的人版本 3.3.638,
我发现没有名为 CreateServiceInstanceListeners()
的扩展方法.我只找到了CreateServiceRemotingInstanceListeners()
和 CreateServiceRemotingReplicaListeners()
在 Microsoft.ServiceFabric.Services.Remoting.Runtime.ServiceRemotingExtensions
.
这段代码为我编译:
protected override IEnumerable<ServiceInstanceListener> CreateServiceInstanceListeners()
{
return this.CreateServiceRemotingInstanceListeners();
}
关于azure-service-fabric - 分区的主实例或无状态实例的地址无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36590933/