The contract name 'WCFTest1.CalculatorService' could not be found in the list of contracts implemented by the service 'CalculatorService'.


  • Hi,

    I'm evidently doing something critically wrong, but I've been banging my head against this for hours, and can't get to the bottom of it. Just trying to get some of the MSDN samples to work so that I can learn from them.

    What I have been finding is that I can get a service to work if I just define a class for it, but as soon as I use an interface, and let the class implement the interface, I get the error message as shown above.

    Environment: Win Xp Pro, VS 2008, .NET framework 3.5sp1.

    Example method and code: Start a new web project, add new item: Silverlight-enabled WCF service, paste in example code as per

    Error shows up whilst the class implements the interface. As soon as the interface is removed from the class (and the class tagged with [ServiceContract], and a method given [OperationContract]), the error disappears. Same seems to hold for every sample I can find.

    I have tried tagging the class as full trust with no effect. I have also tried repairing my installation of .NET 3.5sp1, again with no effect. I suspect it may be something to do with namespaces, but can't get my head around what or why.

    I conclude that it's something fundamental I am doing wrong, but I just can't see what it is. Can anyone help me see my foolishness?
    Tuesday, April 21, 2009 10:49 AM


All replies

  • Hi Stevo,

    is your interface decorated with the ServiceContract attribute?

    Tuesday, April 21, 2009 10:59 AM
  • Hi,

    Yes, the interface is decorated with a ServiceContract attribute as per the code in the MSDN sample in the link. I haven't changed any of the sample code, just pasted it into a newly created Silverlight-enabled WCF service.


    Tuesday, April 21, 2009 11:03 AM
  • from the error it looks like the config file is still referring to the class rather than the interface in the endpoint's contract name
    Richard Blewett, thinktecture -
    • Marked as answer by Stevo Guy Tuesday, April 21, 2009 11:28 AM
    Tuesday, April 21, 2009 11:16 AM
  • Do you have a configuration file? I haven't seen any in the example you provided.
    If that is the case, please refer to this example, it seems a bit more profound.

    Tuesday, April 21, 2009 11:16 AM
  • Thanks,  the config file was still pointing to the class rather than the interface, which I hadn't realised was wrong. With hindsight, fairly obvious, as the interface provides the contract, and the class doesn't.

    I now have a different set of errors to deal with, but at least have a bit more understanding of what I'm doing.

    Thanks for saving me hours more of banging my head against the wall, I'd reached the stage of not being able to see what I was looking at.
    Tuesday, April 21, 2009 11:27 AM
  • Thanks, I'll check out the other example - the more I see, the more I'm likely to figure out what I'm doing :)
    Tuesday, April 21, 2009 11:28 AM