EXTASPNET C# ASP.NET sql server 事务超时,解决方法

 private bool SaveAll()
        {
            TransactionOptions transactionOption = new TransactionOptions(); 
            transactionOption.Timeout = new TimeSpan(0, 0, 600);
            using (TransactionScope tscope = new TransactionScope(TransactionScopeOption.Required, transactionOption))
            {
                using (SharedDbConnectionScope scope = new SharedDbConnectionScope())
                {
                    try
                    {
                        //语句
                        tscope.Complete();

                        return true;
                    }
                    catch (Exception Ee)
                    {
                        tscope.Dispose();
                        logger.Warn(string.Format("错误:错误描绘“{0}”", Ee.Message));
                        return false;
                    }
                }
            }
        }

你可能感兴趣的:(EXTASPNET C# ASP.NET sql server 事务超时,解决方法)