Can I find out what WCF methods are supported on the endpoint before calling it?

Posted by alord1689 on Stack Overflow See other posts from Stack Overflow or by alord1689
Published on 2010-05-18T22:35:34Z Indexed on 2010/05/18 22:40 UTC
Read the original article Hit count: 162

Filed under:
|
|
|

I have a versioning issue with a WCF service contract in which one of the many endpoints which are called for the operation is missing one method from the contract.

My question is, how can I make sure the command is available on the client before attempting to call it?

I tried:

  foreach (var od in proxy.Endpoint.Contract.Operations)
  {
    if (od.Name == "MyMethodName")
    {
      hasMethod = true;
      break;
    }
  }

Unfortunately, this is using the contract from the calling app and does not actually describe the implementations on the endpoint itself. As a result, it returns true even though the endpoint has failed to implement the command.

© Stack Overflow or respective owner

Related posts about c#

Related posts about wcf