2

We have two different networks in our company, 17 and 18

  • 170.17.xxx.xxx
  • 170.18.xxx.xxx

On the 17 network there is a WCF service running which is discoverable. This is configured by the following code:

host.AddDefaultEndpoints();
host.AddServiceEndpoint(new UdpDiscoveryEndpoint());

EndpointDiscoveryBehavior behavior = new EndpointDiscoveryBehavior();
behavior.Scopes.Add(scope);

foreach(ServiceEndpoint endpoint in host.Description.Endpoints)
{
    if(endpoint.IsSystemEndpoint || endpoint is DiscoveryEndpoint    || 
       endpoint is AnnouncementEndpoint || endpoint is ServiceMetadataEndpoint)
        continue;

    endpoint.Behaviors.Add(behavior);
}

A behavior with a scope is added to all non system endpoints and it can be discovered by sending udp packets over the network, a default instance of UdpDiscoveryEndpoint.

Clients discover the service by constructing a DiscoveryClient with a default UdpDiscoveryEndpoint.

DiscoveryClient discoveryClient = new DiscoveryClient(new UdpDiscoveryEndpoint());

FindCriteria criteria = new FindCriteria(typeof(T));
criteria.Scopes.Add(scope);

FindResponse discovered = discoveryClient.Find(criteria);
discoveryClient.Close();

This works fine when both client and service run on the same network. But I would like to have a client running on the 18 network which is able to find the service on the 17 network.

So is it possible to discover services on other networks with DiscoveryClient and UdpDiscoveryEndpoint?

edit

Or can this be a firewall issue?

Serve Laurijssen
  • 9,266
  • 5
  • 45
  • 98

1 Answers1

1

This is not a firewall issue but normal behavior of WS-Discovery. WS-Discovery uses SOAP-over-UDP sent to multicast IP group (239.255.255.250). And multicast packets generally are not routed and stay within limits of local network. Thus DiscoveryClient cannot discover services on other network without external help.

You have two options:

  1. Configure your routers to pass multicast IP traffic between each other. While it is fairly easy to achieve it may load your inter-network link unnecessarily and it also may require help from your ISP or you may need tunneling of some sort.
  2. Set up what is known as "Discovery Proxy" on the network where discoverable services are. Discovery Proxy basically performs discovery locally and then uses HTTP to deliver discovery results to other networks. As Discovery Proxy has the same SOAP WSDL existing WS-Discovery clients may use it without any changes over internet.
Vladimir Bashkirtsev
  • 1,334
  • 11
  • 24
  • @Vladimir Bashkirtsev, I need to implement a WS-Discovery "Discovery Proxy" on my small business network that contains two subnets. After lots of research it appears that there isn't a "ready-to-use" Discovery Proxy that I can buy or download. I'm guessing that I have to program my own Discovery Proxy. I'm not a .NET or C++ programmer, but I do have experience with Windows .CMD, VBA, and PHP, so I understand programming. Would you please make a recommendation as to how I should go about developing a Discovery Proxy? – Bill Vallance Aug 28 '19 at 22:33
  • @BillVallance For starters you should read my answer at https://stackoverflow.com/questions/29370598/ws-discovery-for-cameras-on-different-logical-network/49947754#49947754 . As you have experience you may pull logics/ws-discovery through composer (I have authored that module - ws-discovery implemented in PHP) and then you will need to implement SOAP over HTTP to provide Discovery Proxy services to outside world. – Vladimir Bashkirtsev Aug 29 '19 at 23:46
  • @Vladimir Bashkirtsev, thanks so much for the link! I'll take a look it and see if I can figure it out. – Bill Vallance Aug 30 '19 at 14:52