【发布时间】:2014-07-20 00:05:29
【问题描述】:
我无法让本地环境在模拟器中运行所需的 Azure 部署。
我有一个 WebRole (MyWebSite) 有一个公共 (InputEndpoint),还有一个 WebRole 有一个 InternalEndpoint (MyServiceApplication)。 InternalSite 具有一组向 PublicSite 公开的 WCF 服务。
即
<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 端点。即。
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 变量在 Azure Emulator Express 运行时结果为 http://127.0.0.1:8083/MyService.svc,但它抱怨:
http://127.0.0.1:8083/MyService.svc上没有可以接受消息的端点监听。
但是,当我通过 http://localhost:8083/MyService.svc 浏览到此端点时,我没有问题。
所以我想问题是,如何在 Azure Emulator Express(而不是 localhost)中让 InternalEndpoint 绑定到 127.0.0.1,或者有一种方法可以以编程方式将端点解析为 http://localhost:8083/MyService.svc ?
希望有人能帮忙,
【问题讨论】:
标签: .net wcf azure iis-express azure-emulator