gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 03:08:52 25 4
gpt4 key购买 nike

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

笔记本电脑(可以从此处访问 URL)

^

Windows Server 2016 VM(无法从此处访问)

^

使用 microsoft/aspnet 镜像手动打包 MVC 应用程序的容器

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

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

编辑:忘记提及我的防火墙在我的开发虚拟机中也被禁用。

最佳答案

我认为您正在点击 this问题。除非使用容器 IP 地址,否则无法访问在 localhost 上运行的容器。

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.

关于c# - Service Fabric 容器 - 无法访问集群内的服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41557717/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com