Service Fabric 容器 - 无法访问集群内的服务

Service Fabric Containers - Cannot Access Service within Cluster

我在我的开发 VM 上本地部署了一个 Windows 容器,它只包含一个简单的 MVC 应用程序来测试功能。我可以很好地部署它,并在 http://localhost:30001/ 处获得服务的 Uri,当我从我的主机导航到那个 URL 时它工作正常但是当我在我的 VM 中时我无法访问它具有容器。

Laptop (Can access URL from here)

^

Windows Server 2016 VM (cannot access from here)

^

Container with manually packaged MVC app using the microsoft/aspnet image

部署 SF 应用程序后,我可以通过从 Docker 分配的 ip 和端口访问 MVC 应用程序(通过使用 docker inspect),我还指定了该端口 8745 在我的 AppManifest.xml

当我启动示例应用程序之一(例如 Alphabet 示例)时,我能够访问 VM 中的端点。与不允许这样做的容器有关吗?在创建网关无状态服务时,这是一个大问题,因为分区解析器给我 URL 在集群中无法访问的

编辑: 忘了说我的防火墙在我的开发 VM 中也被禁用了。

我认为您遇到了 this 问题。除非使用容器 ip 地址,否则无法访问本地主机上的容器 运行。

With the current release, you can't use http://localhost to browse your site from the container host. This is because of a known behavior in WinNAT, and will be resolved in future. Until that is addressed, you need to use the IP address of the container.