开发者

WCF communication between two PCs doesnt work

I am trying to make a WCF communication between two machin开发者_如何学运维es in which one will act as server and the other will act as client. I am able to make it work within my system , but it doesnt work when i try to connect to my friend's system.

EDIT: A weird thing is happening now. I just started the wcftestclient from command prompt by giving "wcftestclient address". It retrieved the metadata of my friend's server. But, when i invoke the operation, it gives error "no endpoint listening at localhost" . how can it be localhost? it should be my friend's IP address,right?


The <add baseAddress=...> is a section of the <services> section, not the client. To change the base address used by a WCF client, you need to set the address on the client section:

<client>
  <endpoint address="http://your_friend_ip/address" binding=... contract=..." />
</client>

Also notice that you may need to open some port in the firewall of the service to have the request go through.

Another thing, if your friend's service has metadata enabled, then you can add a service reference on your machine (either using VS Add Service Reference, or using svcutil) by pointing to your friend's service, and that will create the config with the appropriate endpoint address.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜