----------------------------------------------------wcf事务:
1.ACID:原子性、一致性、隔离性、持久性;
2.事务:添加命名空间(using System.Transactions;)
using (TransactionScope ts = new TransactionScope())
{
//操作
ts.Complete();
}
--支持事务流的绑定:NetNamedPipeBinding,nettcpbinding,wshttpbinding,
--在绑定的配置文件;缺省为false;
<binding name="" transactionFlow="true">
--通过代码打开事务流:
NetTcpBinding nb = new NetTcpBinding();
nb.TransactionFlow = true;
--服务契约中:
[TransactionFlow(TransactionFlowOption.Allowed)]
--传输协议选项:
<binding name="" transactionFlow="true" transactionProtocol="WSAtomicTransaction11">
--设置事务超时:
<behaviors>
<serviceBehaviors>
<behavior name="AllenBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
<serviceTimeouts transactionTimeout="00:20:00"/>
</behavior>
</serviceBehaviors>
或者是:
[ServiceBehavior(TransactionTimeout="00:20:00")]
public class guo : Iguo