Suppose you have created a WCF service. You have an interface stating your methods that must be exposed to the clients. But you have forgotten to specify "[OperationContract]" attribute in any of your method. What will happen ?

 Posted by Akiii on 4/8/2012 | Category: WCF Interview questions | Views: 4618 | Points: 40

If you do not specify "[OperationContract] " in any of the methods in your interface then you will get the following error :-

IService1' has zero operations; a contract must have at least one operation 

Here, Iservice is the name of my Interface. you can have your own name.
So, it is mandatory to label "[OperationContract] " attribute to at least one method while declaring your interface methods or ServiceContract.

Thanks and Regards

| Alert Moderator 

Comments or Responses

Login to post response