两个端点有状态服务不起作用
Two endpoints Stateful service doesnt work
我已将我的 servicefabric 有状态服务设置为使用两个侦听器端点
- ServiceRemoting V2
- WCF 远程处理
我的 CreateServiceReplicaListerners()
看起来像这样 -
return new[]
{
new ServiceReplicaListener((c) => new FabricTransportServiceRemotingListener(c, this),
"dataServiceRemotingListener"),
new ServiceReplicaListener((context) =>
new WcfCommunicationListener<IReferenceDataService>(
wcfServiceObject:this,
serviceContext:context,
//
// The name of the endpoint configured in the ServiceManifest under the Endpoints section
// that identifies the endpoint that the WCF ServiceHost should listen on.
//
endpointResourceName: "WcfDataServiceEndpoint",
//
// Populate the binding information that you want the service to use.
//
listenerBinding: WcfUtility.CreateTcpListenerBinding()
), "dataServiceWCFListener")
};
但是,在测试中我发现只有一个端点有效。具体来说,只有第一个注册的才有效。在上面的例子中,Service Remoting 工作但 WCF 侦听器没有。在我试图进行 wcf 调用的客户端中,我不断收到错误 - The provided URI scheme 'localhost' is invalid; expected 'net.tcp'.
当更改它们的注册顺序时,WCF 远程处理工作但 SeviceRemoting 不工作。这看起来像一个错误,不确定是否有人遇到过类似的问题?
请指教
更新:
这是我的客户端详细信息
_service = serviceProxyFactory.CreateServiceProxy<IReferenceDataService>(
new Uri("fabric:/DataService/ReferenceDataService"),
new ServicePartitionKey(0));
创建代理时指定侦听器名称。
var proxy = _serviceProxyFactory.CreateServiceProxy<IMyService>(MyServiceUri, new ServicePartitionKey(partitionKey), TargetReplicaSelector.PrimaryReplica, "dataServiceRemotingListener");
如果省略名称,将使用第一个端点。根据您 return 听众的顺序,远程处理是否有效。
此外,请确保您在服务清单中声明了 2 个端点。
我已将我的 servicefabric 有状态服务设置为使用两个侦听器端点
- ServiceRemoting V2
- WCF 远程处理
我的 CreateServiceReplicaListerners()
看起来像这样 -
return new[]
{
new ServiceReplicaListener((c) => new FabricTransportServiceRemotingListener(c, this),
"dataServiceRemotingListener"),
new ServiceReplicaListener((context) =>
new WcfCommunicationListener<IReferenceDataService>(
wcfServiceObject:this,
serviceContext:context,
//
// The name of the endpoint configured in the ServiceManifest under the Endpoints section
// that identifies the endpoint that the WCF ServiceHost should listen on.
//
endpointResourceName: "WcfDataServiceEndpoint",
//
// Populate the binding information that you want the service to use.
//
listenerBinding: WcfUtility.CreateTcpListenerBinding()
), "dataServiceWCFListener")
};
但是,在测试中我发现只有一个端点有效。具体来说,只有第一个注册的才有效。在上面的例子中,Service Remoting 工作但 WCF 侦听器没有。在我试图进行 wcf 调用的客户端中,我不断收到错误 - The provided URI scheme 'localhost' is invalid; expected 'net.tcp'.
当更改它们的注册顺序时,WCF 远程处理工作但 SeviceRemoting 不工作。这看起来像一个错误,不确定是否有人遇到过类似的问题?
请指教
更新:
这是我的客户端详细信息
_service = serviceProxyFactory.CreateServiceProxy<IReferenceDataService>(
new Uri("fabric:/DataService/ReferenceDataService"),
new ServicePartitionKey(0));
创建代理时指定侦听器名称。
var proxy = _serviceProxyFactory.CreateServiceProxy<IMyService>(MyServiceUri, new ServicePartitionKey(partitionKey), TargetReplicaSelector.PrimaryReplica, "dataServiceRemotingListener");
如果省略名称,将使用第一个端点。根据您 return 听众的顺序,远程处理是否有效。
此外,请确保您在服务清单中声明了 2 个端点。