Service Fabric Stateful Service Remoting V2

£可爱£侵袭症+ 提交于 2019-12-03 17:49:48

问题


I have a Stateful Service called by a Stateless service, in .Net Standard Asp.net Core 2.0 running on Visual Studio 15.4. I can't make the Service Remoting V2 work.

The old code in the Stateful service that worked for V1 is not valid anymore

  protected override IEnumerable<ServiceReplicaListener> CreateServiceReplicaListeners()
    {
        return new List<ServiceReplicaListener>()
            {
                new ServiceReplicaListener((context) =>this.CreateServiceRemotingListener(context))
            };

I tried to follow this tutorial but the example is for the stateless one.

I tried to change the code in this without success.

protected override IEnumerable<ServiceReplicaListener> CreateServiceReplicaListeners()
    {
        return new List<ServiceReplicaListener>()
            {
                new ServiceReplicaListener((c) =>new FabricTransportServiceRemotingListener(c, this))
            };
    }

Also there are no instructions on how or where to use this code in the tutorial

var proxyFactory = new ServiceProxyFactory((c) =>
   {
       return new FabricTransportServiceRemotingClientFactory();
   });

I'm stuck, could someone show me how to make it work?


回答1:


In your stateful service, in method CreateServiceReplicaListeners, use this code:

protected override IEnumerable<ServiceReplicaListener> CreateServiceReplicaListeners()
{
    return this.CreateServiceRemotingReplicaListeners();
}

And in the file that defines your remoting service interface, add this:

[assembly: FabricTransportServiceRemotingProvider(RemotingListener = RemotingListener.V2Listener, RemotingClient = RemotingClient.V2Client)]

(for example, just below the using namespaces list.)

Add the endpoint: <Endpoint Name="ServiceEndpointV2" />

And rebuild the client.



来源:https://stackoverflow.com/questions/46743800/service-fabric-stateful-service-remoting-v2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!