【发布时间】:2016-04-22 12:39:33
【问题描述】:
基本思想 - 我有一个无状态服务,它通过 http 实现 Owin 通信侦听器,以服务基于 WebApi 的公共客户端。我想添加第二个侦听器,它将使用内置的 ServiceRemotingListener() 通过 Rpc 在集群内接收请求。原因是我不希望这个监听器是公共的,因为它为无状态服务实现了一个非公共的管理接口。这是设置...:
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")
};
}
当我添加第二个侦听器时,启动应用程序时出现异常...
this.serverHandle = WebApp.Start(this.listeningAddress, appBuilder => this.startup.Configuration(appBuilder));
抛出异常:System.dll 中的“System.Net.Sockets.SocketException” 抛出异常:System.ServiceModel.dll 中的“System.ServiceModel.CommunicationException” 抛出异常:System.ServiceModel.dll 中的“System.ServiceModel.CommunicationException” 抛出异常:System.ServiceModel.Internals.dll 中的“System.ServiceModel.CommunicationException” --多次重复-- 抛出异常:System.Fabric.dll 中的“System.ServiceModel.CommunicationException”
(不确定如何获取异常详细信息。我的“try {}”环绕 没有捕获异常。)
一旦处于这种状态,我会在服务尝试自动重启时收到后续异常 - 这些错误与端口共享有关。
我可以做些什么来让 WebApi 通信侦听器与 ServiceRemotingListener 一起工作?我假设在这一点上,ServiceRemotingListener 也在使用 http 并且它们不能很好地协同工作。
【问题讨论】:
-
我使用的端口好像被防火墙阻止了。我得到了同样的异常,但现在我也得到了一个具有相同错误的 CommunicationException,但它将端口标识为 0.0.0.0:8080。 " 侦听 IP Endpoint=0.0.0.0:8080 时发生 TCP 错误(10013:尝试以访问权限禁止的方式访问套接字)。"
-
ServiceRemotingListener 不使用 HTTP。如果没有 OwinCommunicationListener,您可以让 ServiceRemotingLIsener 自行工作吗?
-
我会试一试,明天再报告。谢谢!
-
当我自己设置 ServiceRemotingListener 时,节点报告 {"Endpoints":{"MyRpc":"net.tcp:\/\/localhost:8083\/2c44446c-4c4e-479a -ac48-13c5b664b8c6\/0b91d2a3-80c3-4c30-b9b4-490672a8c077-130979017853872413"}}。调查为什么决定使用 tcp....
-
..当我使用监听地址“http://+:8083/bc35bdfc-c488-473e-aaa2-5bdc6b763b9f/130979290464827805/99d163c8-e462-4a8f-8bfa-”添加IOwinCommunicationListener 821d9308790e”,我再次收到“试图以访问权限禁止的方式访问套接字”错误。