摘要:
TransactionFlowOption有三个选项: 一为NotAllowed,这代表了禁止客户端传播事务流到服务端,即使客户端启动了事务,该事务也会被忽略; 二为Allowed,这代表允许客户端的事务传播到服务端,但服务器端不一定会引用到此事务; 三为Mandatory,这代表服务端与客户端必须同时启动事务流,否则就会抛出InvalidOperationException异常。[ServiceContract(SessionMode=SessionMode.Required)] public interface IOrdersService { [OperationContrac... 阅读全文
摘要:
ServiceContract OperationContractServiceBehavior OpenrationBehavior[ServiceContract(SessionMode = SessionMode.Allowed)] public interface Iservice [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession)] public class serviceclass : Iservice---------------------------------------------- 阅读全文
摘要:
1. DataContract - new class FaultMessage [DataContract] public class FaultMessage { [DataMember] public string ErrorCode { get; set; } [DataMember] public string Message { get; set; } }2. WCF Service try { return XXX; }catch(Exception ex) { FaultMessage faultMessage = new FaultMessage(... 阅读全文
摘要:
消息处理(异步调用OneWay, 双向通讯Duplex) 转自 http://www.cnblogs.com/webabcd/archive/2008/04/14/1153027.html介绍WCF(Windows Communication Foundation) - 消息处理:通过操作契约的IsOneWay参数实现异步调用,基于Http, TCP, Named Pipe, MSMQ的双向通讯。示例(异步调用OneWay)1、服务IOneWay.csusingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem 阅读全文