【发布时间】:2011-03-14 15:23:17
【问题描述】:
我需要测试 WCF 服务,但只有一台计算机,所以我的服务和客户端在同一台机器上运行。这是 WCF 服务的 App.config:
<host>
<baseAddresses>
<add baseAddress="http://localhost:8000/MyService"/>
</baseAddresses>
</host>
<endpoint address=""
binding="wsDualHttpBinding"
contract="MyService.IMyService"/>
我需要通过IP从我的客户端连接到这个服务,所以我尝试了以下操作:
MyClient.Endpoint.Address =
new System.ServiceModel.EndpointAddress(
new Uri("http://" + IP + "/" + Port + "/MyService"));
其中 IP =“127.0.0.1”和端口 =“8000”。我也尝试使用我的真实 IP 地址而不是 127.0.0.1 但它无论如何都不起作用 - 客户端无法连接到服务。
- 如果我使用wsDualHttpBinding,是否可以通过IP连接,如果可以,
- 我应该为它指定什么 Endpoint.Address
【问题讨论】:
-
“不起作用”是什么意思?有例外吗?发布吧!
标签: wcf service connection ip-address localhost