Discover locally running WCF from WP7
-
21-04-2021 - |
Domanda
I have a WCF service running inside Windows Service and it is located on my local network. What I want is to be able to discover WCF from my Silverlight app on my WP7 (on the same network).
I know there a Discovery feature in WCF, however it requires to UDP, which is not supported on WP7. So are there any other ways to discover local WCF?
I also do not know prior to launching WCF the IP address of the WCF service.
Soluzione
The solution I came up with, is to use Sockets as on WP7 they support multicast. So set up would like this:
- Desktop service - Windows Service hosting WCF and small Socket app which listens on specific port.
- WP7 client - before connecting to WCF a broadcast would be sent using Sockets to find out an IP address of the machine which runs WCF, when got a response connect to WCF.
Altri suggerimenti
For a WCF Service to be referenced in a WP7 project the WCF Service MUST be a BasicEndpoint
You could provide a basic endpoint that exposes a kind of catalog service. It doesn't have to implement UDDI but it could be a custom protocol to suit your needs and return addresses of web services.
This way you only need to know a single address. Of course you can cache returned addresses and query the catalog service only when you are not able to connect.