我是Service Fabric的新手,在练习中,我完成了一个可靠的无状态服务,该服务在RunAsync中增加了他的属性“ counter”。我验证可以通过接口IService公开返回此计数器值(通过ServiceProxy从客户端调用的方法)的方法,显然可以覆盖CreateServiceInstanceListeners并添加CreateServiceRemotingListener。然后,我尝试添加另一个自定义通信侦听器SS1ServiceEndpoint(在指定的端口7080上侦听):
<Endpoint Name="RemoteListener" />
<Endpoint Name="SS1ServiceEndpoint" Protocol="http" Port="7080" Type="Input" />
Run Code Online (Sandbox Code Playgroud)
但是服务最初会抛出
Exception thrown: 'System.ArgumentException' in Microsoft.ServiceFabric.FabricTransport.dll
Run Code Online (Sandbox Code Playgroud)
然后,越来越多地调用自定义侦听器的OpenAsync方法,并且每次调用后都会引发另一个异常:
Exception thrown: 'System.ObjectDisposedException' in mscorlib.dll
Exception thrown: 'System.AggregateException' in mscorlib.dll
Exception thrown: 'System.Fabric.FabricElementAlreadyExistsException' in
System.Fabric.dll
Exception thrown: 'System.ArgumentException' in
Microsoft.ServiceFabric.FabricTransport.dll
Run Code Online (Sandbox Code Playgroud)
如果我在CreateServiceInstanceListeners中删除CreateServiceRemotingListener,则服务会启动,并且可以从浏览器上的侦听端口调用它。
我的问题是:不支持多个侦听器吗?我没有尝试使用两个自定义侦听器(在不同的端口上)。