1. 不要将单向调用设置为异步调用。
2. 不要将单向调用设置为并发调用。
3. 对单向操作抛出的异常做出预期。
4. 为单向调用启用可靠性。对于单向调用而言,使用有序传递属于可选项。
5. 避免在会话服务中定义单向操作。如果定义了,则应将它定义为终止操作:
[ServiceContract(SessionMode= SessionMode.Required)]
interface IMyContract
{
[OperationContract]
void MyMethod1();
[OperationContract(IsOneWay = true, IsInitiating = false,IsTerminating = true)]
void MyMethod2();
}
6. 为服务端的回调契约取名时,应使用服务契约名加上Callback后缀:
interface IMyContractCallback