【发布时间】:2017-10-19 11:08:30
【问题描述】:
我是 Service Fabric 的新手,在我的练习中,我已经完成了一个可靠的无状态服务,它在 RunAsync 中增加了他的属性“计数器”。我验证了我可以通过接口 IService 公开一个返回此计数器值的方法(通过 ServiceProxy 从客户端调用的方法),显然覆盖了 CreateServiceInstanceListeners 并添加了 CreateServiceRemotingListener。 然后我尝试添加另一个自定义通信监听器 SS1ServiceEndpoint(监听指定端口 7080):
<Endpoint Name="RemoteListener" />
<Endpoint Name="SS1ServiceEndpoint" Protocol="http" Port="7080" Type="Input" />
但服务最初会抛出
Exception thrown: 'System.ArgumentException' in Microsoft.ServiceFabric.FabricTransport.dll
然后自定义监听器的 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
如果我在 CreateServiceInstanceListeners 中删除 CreateServiceRemotingListener,服务就会启动,我可以从浏览器的监听端口调用它。
我的问题是:不支持多个侦听器吗?我没有尝试过使用两个自定义侦听器(在不同的端口上)。
【问题讨论】: