Explain One Way Contract In WCF ? | WCF Interview Question

, ,
WCF One Way Contract are methods/operations which are invoked on the service by the client or the server in which either of them do not expect a reply back. In other words, If a client invokes a method on the service then it will not expect a reply back from the service.

One way contract is used to ensure that the WCF client does not go in a blocking mode . If your WCF operation contracts are returning nothing and they are doing some heavy process then it is better to use one way contract.

WCF one way contract is implemented via "IsOneWay = true/false" attribute as given below.

[ServiceContract]

interface IMyContract

{

   [OperationContract(IsOneWay = true)]

   void MyMethod( );

}