能够访问 WorkerRole 的内部端点

Able to access Internal endpoint of WorkerRole

我有一个工人角色。我已经用 public 端口 8080 和私有端口定义了一个输入端点作为 8081。我无法访问应该重定向到私有端口的 8080,并且我能够直接访问不应该访问的内部端点(私有端口) .

我的工作者角色 运行 方法被覆盖。

HttpListener objHttpListener = new HttpListener();
            objHttpListener.Prefixes.Add("http://+:8081/");
            objHttpListener.Start();

我正在尝试使用无法正常工作的 http//localhost:8080 进行访问。 http//localhost:8081 正在工作,这是私有端口。

端点映射特别是从 public 端口到专用端口。如果您通过 public 端点,public 端口 只能 访问。

因此,在您的情况下,您将 public 端口 8080 映射到私有(本地)端口 8081。如果您想从您的角色实例中打开连接,您可以:

  • 连接到 yourapp.cloudapp.net:8080(实际上会连接到您的 VM 的本地端口 8081)
  • 连接到 localhost:8081

您无法连接到 localhost:8080 并且期望流量被路由到端口 8081。端口映射是通过 VM(角色实例)本身之外的 Azure 负载均衡器完成的。