You are implementing a Windows Communication Foundation (WCF) client application that consumes the ICatalog and lCatalog2 service interfaces.
You need to ensure that the client discovers services implementing these interfaces.
The services may already be online or may come online within a 30 second time limit. How should you use WCF Discovery to accomplish this?
A.
Create one FindCriteria object for each interface and set the Duration of each FindCriteria to 30 seconds.
Call the FindAsync method of the DiscoveryClient class twice, one time for each of the FindCriteria objects, to search for the services.
B.
Create one FindCriteria object for each interface and set the Duration of each FindCnteria to two seconds.
Create a loop that calls the Find method of the DiscoveryClient class to search for the services.
Within each loop iteration, call the Find method of the DiscoveryClient class once for each of the FindCriteria objects.
Run the loop until a service is found or 30 seconds pass.
C.
Create a single FindCriteria object and add both interfaces to its ContractTypeNames collection. Set the criteria’s Duration to two seconds.
Create a loop that calls the Find method of the DiscoveryClient class to search for the services.
Within each loop iteration, call the Find method of the DiscoveryClient class to search for the services Run the loop until a service is found or 30 seconds pass.
D.
Create a single FindCritera object and add both interfaces to the ContractTypeNames collection.
Set the Duration to 30 seconds and use the FindAsync method of the DiscoveryClient class to search for the services.
Explanation:
I saw the answer D!!FindCriteria
FindCriteria has several properties, which can be grouped into search criteria, which specify what services you are looking for,
and find termination criteria (how long the search should last). A FindCriteria can contain multiple search criteria.
By default, the service has to match all of the components otherwise it does not consider itself a matching service.
If you want to find services that only match some of the criteria, you can implement custom find logic on the service or you can use multiple queries.Search criteria include:
ContractTypeNames – Optional. The contract name of the service being searched for and the criteria typically used when searching for a service.
If more than one contract name is specified, only service endpoints matching ALL contracts reply.
Note that in WCF an endpoint can only support one contract.
Scopes – Optional. Scopes are absolute URIs that are used to categorize individual service endpoints.
You may want to use this in scenarios where multiple endpoints expose the same contract and you want a way to search
for a subset of the endpoints. If more than one scope is specified, only service endpoints matching ALL scopes reply.
ScopeMatchBy – Specifies the matching algorithm to use while matching the scopes in the Probe message with that of the endpoint.
There are five supported scope-matching rules:
ScopeMatchByExact does a basic case-sensitive string comparison.
ScopeMatchByPrefix matches by segments separated by /. A search for http://contoso/building1 matches a service with scope http://contoso/building/floor1.
Note that it does not match http://contoso/building100 because the last two segments do not match.
ScopeMatchByLdap matches scopes by segments using an LDAP URL.
ScopeMatchByUuid matches scopes exactly using a UUID string.
ScopeMatchByNone matches only those services that do not specify a scope.
If a scope-matching rule is not specified, ScopeMatchByPrefix is used.Termination criteria include:
Duration – The maximum time to wait for replies from services on the network. The default duration is 20 seconds.
MaxResults – The maximum number of replies to wait for. If MaxResults replies are received before Duration has elapsed, the find operation ends.Discovery Find and FindCriteria
(http://msdn.microsoft.com/en-us/library/ee816866.aspx)
Looks like ans is D. can anyone help?
0
0
Answer is not D. It’s not A either.
You want to specify one FindCriteria object for each interface, (if you specify both then only endpoints matching ALL contracts reply). That means the answer is either A or B.
Now the question is which one is correct. I personally go with B, because the question states that the service may not be already online. So if you just call it once, and the servies are down, then you will not get a response. The fact that you set duration to 30 seconds, means that your function will return in 30 seconds, but since the service was down when you called it you will not get a response.
That’s why B is the only right choice. It checks every 2 seconds.
0
0