Opening a WCF Metadata Service

Hey. I am looking for an example WCF that includes service discovery and a binding type discovery / discovery method. I think this can be done through metadata sharing,

+3
source share
1 answer

I found the correct answer, here are the steps to complete the task:

  • Add endpoint mex.
  • Add exachange metadata behavior.
  • the client application uses discovery with metadata criteria.

Discovery with metdatada criteria

DiscoveryClient discoveryClient = new DiscoveryClient(new UdpDiscoveryEndpoint());
FindCriteria findCriteria =   FindCriteria.CreateMetadataExchangeEndpointCriteria    (ContractType);
    findCriteria.Duration = TimeSpan.FromSeconds(15);
    findCriteria.MaxResults = 1;// MaxResults;

    FindResponse result = discoveryClient.Find(findCriteria);
    discoveryClient.Close();


    ServiceEndpointCollection eps = MetadataResolver.Resolve(ContractType, result.Endpoints[0].Address);
    return eps[0].Binding;
+3
source

All Articles