Home » Microsoft » 70-487 v.2 » Which code segments should you include in Target 1, Target 2, Target 3, Target 4 and Target 5 to complete the markup?
DRAG DROP
You are developing a self-hosted WCF service to display data about books. The solution contains a service named BookService that implements the IBookService interface.
You need to expose the metadata in the service host programmatically.
You have the following code:
Which code segments should you include in Target 1, Target 2, Target 3, Target 4 and Target 5 to complete the markup? (To answer, drag the appropriate code segments to the correct targets in the answer area. Each code segment may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.)
Select and Place:
Correct Answer:
Explanation/Reference:
How to: Publish Metadata for a Service Using Code
Target 1: ServiceHost Target 2: ServiceHost
Within the mainmethod of a console application, instantiate a ServiceHost object by passing in the service type and the base address Example:
ServiceHost svcHost = new ServiceHost( typeof(SimpleService), new Uri("http;//localhost:8001 /MetadataSample"));
Target 3: ServiceMetaDataBehavior Target 4: ServiceMetaDataBehavior Create a new ServiceMetadataBehavior instance.
Target 5: true
Set the HttpGetEnabled property to true.
References: https://msdn.microsoft.com/en-us/library/aa738489(v=vs.110).aspx