Azure Service Fabric - 无法绑定到已在使用的地址

Azure Service Fabric - Failed to bind to address address already in use

当 运行 在本地(再次新鲜且开箱即用)azure fabric 集群上使用基本无状态服务(带有 WeatherForecastController 的开箱即用模板)时,我收到以下错误。尽管应用程序仅在节点 2 上 运行,但 5 个节点中的 4 个(只有 Node4 没有错误)显示相同的错误。

Unhealthy event: SourceId='System.RA', Property='ReplicaOpenStatus', HealthState='Warning', ConsiderWarningAsError=false. Replica had multiple failures during open on _Node_1. API call: IStatelessServiceInstance.Open(); Error = System.IO.IOException (-2146232800) Failed to bind to address http://[::]:8390: address already in use.

我曾尝试更改 ServiceManifest.xml 中的 IP 地址,但再次出现相同的错误。

这到底是怎么回事?

您的本地开发集群在一台机器上运行,第一个服务副本声明端口。如果其他人无法共享端口,则无法启动。

要解决这个问题,可以:

  • 运行 本地开发集群上的一项服务 instance/replica(使用 Local.1Node.xml 发布配置文件)
  • 运行 多个服务,但使用动态端口(在服务清单的端点规范中省略 Port
  • 使用支持端口共享的平台,比如http.sys

更多信息here