3

Wcf novice here.

My service has 4 endpoints with 4 different contract. This because i had some requirement to fulfill. Now, i don't want to use a fixed port and i read HERE i could use listenUriMode="Unique" in the endpoint configuration to get the first free port to use.

this works and my service goes up correctly. Since i don't know what port has been used i have to use WCF discovery to reach my service.

My client search for endpoints with this code

DiscoveryClient discoveryClient = new DiscoveryClient(new UdpDiscoveryEndpoint());
FindCriteria findCriteria = new FindCriteria(typeof(ImyServiceInterface));

findCriteria.Duration = TimeSpan.FromSeconds(5);

FindResponse findResponse = discoveryClient.Find(findCriteria);

MessageBox.Show(string.Format("Endpoints found: {0}", findResponse.Endpoints.Count));

this works, but only for the endpoint with ImyServiceInterface interface. I can do 4 scans and get my 4 endpoints, but it sounds like the VERY wrong way to do this (and it requires 4 times the normal time to complete).

How can i do this? Creating another endpoint and giving him a function to comunicate all the others endpoint? Or i'm doing all this in the wrong way and i'm just wasting my time?

Community
  • 1
  • 1
HypeZ
  • 4,017
  • 3
  • 19
  • 34

0 Answers0