When an operation has no return value, and the client does not care about the success or failure of the invocation. WCF offers one-way operations to support this sort of fire-and-forget invocation,: once the client issues the call, WCF generates a request message, but no correlated reply message will ever return to the client. The one-way message exchange pattern is useful when a client needs to send information to a service but doesn't receive a response.
Use the one-way design pattern:
- When the client must call operations and is not affected by the result of the operation at the operation level.
- When using the NetMsmqBinding or the MsmqIntegrationBinding class. (For more information about this scenario, see Queues in Windows Communication Foundation.)
To create a one-way service contract, define your service contract, apply the OperationContractAttribute class to each operation, and set the IsOneWay property to true, as shown in the following sample code.