CustomDiscoveryMetadata

This sample shows how to insert custom XML metadata into the discovery metadata for a discoverable endpoint exposed by a service. The sample then shows how a client can search for the service and extract this custom data. This sample consists of two projects, service and client.

Service

In the main method, the sample shows that an object of type XElement is populated with the desired fields and is added to the EndpointDiscoveryBehavior. This EndpointDiscoveryBehavior is added to a particular endpoint. When that particular endpoint is discovered, the discovery metadata contains the custom data that was added here.

Client

The sample shows the Find method being called on a DiscoveryClient. The resulting FindResponse is then queried for the appropriate and expected XML elements. These elements are then printed to the console.

To use this sample

  1. Load the project solution in Visual Studio 2010 and build the project.

  2. First run the Service application, generated in [solution base directory]\service\bin\debug, and then run the Client application, generated in [solution base directory]\Client\bin\debug

  3. Note that the service comes online, the client locates the service and prints the metadata published in the endpoint.

Dd764464.Important(en-us,VS.100).gif Note:
The samples may already be installed on your machine. Check for the following (default) directory before continuing.

<InstallDrive>:\WF_WCF_Samples

If this directory does not exist, go to Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4 to download all Windows Communication Foundation (WCF) and WF samples. This sample is located in the following directory.

<InstallDrive>:\WF_WCF_Samples\WCF\Extensibility\DiscoveryExtensibility\CustomDiscoveryMetadata