Health check a WCF service.

By [)ia6l0 iii

Use the MetadataExchangeClient's GetMetadata method to retrieve meta data of a wcf service using the HttpGet mode.

This ensures that errors like ""Metadata contains a reference that cannot be resolved"" are captured and the retrieved meta data is null in such cases.

The following snippet shows you exactly that.

MetadataExchangeClient client = new MetadataExchangeClient
                    (new Uri(Convert.ToString(url), MetadataExchangeClientMode.HttpGet);
MetadataSet metaData = client.GetMetadata();

if (metaData == null)

Health check a WCF service.  (1872 Views)