Basic Idea - I have a stateless service that implements an Owin communication Listener over http to service WebApi based public clients. I want to add a second listener that will receive requests within the cluster over Rpc using the built in ServiceRemotingListener(). The reason is that I don't want this listener to be public as it implements a non-public management interface for the stateless service. Here is the setup...:
protected override IEnumerable<ServiceInstanceListener> CreateServiceInstanceListeners()
{
return new[]
{
new ServiceInstanceListener(initParams => new OwinCommunicationListener("MyWebService", new Startup(_options, this), initParams),"MyServiceHttp"),
new ServiceInstanceListener(initParams => new ServiceRemotingListener<Interfaces.IConfig>(initParams, this),"MyServiceRpc")
};
}
When I add the second listener, I get an exception starting the app...
this.serverHandle = WebApp.Start(this.listeningAddress, appBuilder => this.startup.Configuration(appBuilder));
Exception thrown: 'System.Net.Sockets.SocketException' in System.dll Exception thrown: 'System.ServiceModel.CommunicationException' in System.ServiceModel.dll Exception thrown: 'System.ServiceModel.CommunicationException' in System.ServiceModel.dll Exception thrown: 'System.ServiceModel.CommunicationException' in System.ServiceModel.Internals.dll --multiple repeats--- Exception thrown: 'System.ServiceModel.CommunicationException' in System.Fabric.dll
(not sure how to get the exception details. My "try {} " surrounding did not trap an exception.)
Once in this state, I get subsequent exceptions as the service attempts to auto-restart - the errors are about port sharing.
Anything I can do to make WebApi communication listeners work alongside ServiceRemotingListener? I am assuming at this point that under the hood, ServiceRemotingListener is using http as well and they don't play nicely together.