3
我需要測試WCF服務,但只有一臺計算機,所以我的服務和客戶端在同一臺計算機上運行。這裏是WCF服務的App.config中:
WCF:如何通過IP連接服務:端口
<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,但它無法工作 - 客戶端無法連接到服務。
- 它可以通過IP,如果我使用wsDualHttpBinding連接,如果是,
- 我應該指定什麼Endpoint.Address它
你是什麼意思,「不起作用」?是否有例外?發表它! – 2010-07-12 04:34:13