Wednesday, March 7, 2012

Checking availibility of WCF service

I've got one method from the book "Programming WCF Services" by Juval Lowy (page 71).
Code Snippet:

   MetadataExchangeClient mexClient =

bool isServiceUp = true;
string address = "http://localhost/MyService.svc?wsdl";new MetadataExchangeClient(newUri(address), MetadataExchangeClientMode.HttpGet);
MetadataSet metadata = mexClient.GetMetadata();
// if service down I get the exception
   catch (Exception ex)
isServiceUp =

I catch the Exception like {"Metadata contains a reference that cannot be resolved: "http://localhost/MyService.svc?wsdl"} System.Exception {System.InvalidOperationException}

No comments:

Post a Comment