Condividi tramite


Request-Reply Services

Request-reply services are the default type of operation contract in Windows Communication Foundation (WCF). Clients make calls to service operations and wait for a response from the service. You can perform calls to a service operation either synchronously, where the client blocks until it receives a response from the service or the call times, or asynchronously, where the client makes a call to the service operation, continues working, and receives the response from the service on another thread.

To create a request-reply service contract, define your service contract, and apply the OperationContractAttribute class to each operation, as shown in the following sample code.

[ServiceContract(Namespace="http://Microsoft.ServiceModel.Samples")]
public interface IRequestReplyCalculator
{
    [OperationContract]
    double Add(double n1, double n2);
}

You do not have to set the IsOneWay property to false because this is the default behavior.

Vedere anche

Concetti

One-Way Services
Servizi duplex