服务结构状态服务远程处理V2 [英] Service Fabric Stateful Service Remoting V2
问题描述
在Visual Studio 15.4上运行的.Net Standard Asp.net Core 2.0中,我有一个由无状态服务调用的有状态服务. 我无法使Service Remoting V2正常工作.
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.
用于V1的有状态服务中的旧代码已不再有效
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?
推荐答案
在您的有状态服务的方法CreateServiceReplicaListeners
中,使用以下代码:
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)]
(例如,在using
名称空间列表的下面.)
(for example, just below the using
namespaces list.)
添加端点:
<Endpoint Name="ServiceEndpointV2" />
并重建客户端.
这篇关于服务结构状态服务远程处理V2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!