0

我无法让我的本地环境在模拟器中运行我想要的 Azure 部署。

我有一个(MyWebSite)具有公共 (InputEndpoint) 的 WebRole 和一个具有 InternalEndpoint 的 WebRole (MyServiceApplication)。InternalSite 具有一组向 PublicSite 公开的 WCF 服务。

IE

  <WebRole name="MyServiceApplication"  vmsize="Small">
    <Sites>
      <Site name="Web">
        <Bindings>
          <Binding name="Endpoint1" endpointName="MyInternalEndpoint" />
        </Bindings>
      </Site>
    </Sites>
    <Endpoints>
      <InternalEndpoint name="MyInternalEndpoint" port="8083" protocol="http"></InternalEndpoint>
    </Endpoints>
  </WebRole>
  <WebRole name="MyWebSite" vmsize="Small">
    <Sites>
      <Site name="Web">
        <Bindings>
          <Binding name="Endpoint1" endpointName="Endpoint1" />
        </Bindings>
      </Site>
    </Sites>
    <Endpoints>
      <InputEndpoint name="Endpoint1" protocol="http" port="80" />
    </Endpoints>
  </WebRole>

我从 MyWebSite 以编程方式连接到 MyServiceApplication 端点。IE。

var applicationRole = RoleEnvironment.Roles["MyServiceApplication"].Instances.First().InstanceEndpoints["MyInternalEndpoint"].IPEndpoint;
var endPointAddress = string.Format("http://{0}:{1}/MyService.svc", applicationRole.Address, applicationRole.Port);
var channel = channelFactory.CreateChannel(new EndpointAddress(endPointAddress));

endPointAddress变量原来是http://127.0.0.1:8083/MyService.svc在 Azure Emulator Express 中运行时,但它抱怨:

没有http://127.0.0.1:8083/MyService.svc可以接受消息的端点监听。

但是,当我通过 浏览到此端点时http://localhost:8083/MyService.svc,我没有问题。

所以我想问题是,我怎样才能127.0.0.1在 Azure Emulator Express 中绑定到 InternalEndpoint(而不是 localhost),或者有没有一种方法可以以编程方式将端点解析为http://localhost:8083/MyService.svc

希望有人能帮忙,

4

1 回答 1

1

对于任何感兴趣的人,当我以管理员权限运行 Visual Studio 时,这两个角色都绑定到 127.0.0.1(而不是 localhost)。

不完全确定为什么会这样,但它为我做了诀窍。

于 2014-07-21T09:57:38.127 回答