这个异常发生在这里:
public void updateAccount(CommonLayer.Account account)
{
Entity.SaveChanges();
}
堆栈跟踪:
[SqlException(0x80131904):不允许新事务,因为会话中还有其他线程在运行。] System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action
1 wrapCloseInAction) +1753986 System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action
1 wrapCloseInAction) +5296058 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +558 System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet stateOjbjHandler, TdsParser , Boolean & dataReady) +1682 System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +69 System.Data.SqlClient.TdsParser.TdsExecuteTransactionManagerRequest(Byte[] 缓冲区, TransactionManagerRequestType 请求, String transactionName, TransactionManagerIsolationLevel isoLevel, Int32 timeout, SqlInternalTransaction 事务,TdsParserStateObject stateObj, Boolean isDelegateControlRequest) +796 System.Data.SqlClient.SqlInternalConnectionTds.ExecuteTransactionYukon(TransactionRequest transactionRequest, String transactionName, IsolationLevel iso, SqlInternalTransaction internalTransaction, Boolean isDelegateControlRequest) +395 System.Data.SqlClient.SqlInternalConnectionTds.ExecuteTransaction(TransactionRequest transactionRequest, String name , IsolationLevel iso, SqlInternalTransaction internalTransaction, Boolean isDelegateControlRequest) +137 System.Data.SqlClient.SqlInternalConnection.BeginSqlTransaction(IsolationLevel iso, String transactionName) +230 System.Data.SqlClient.SqlInternalConnection.BeginTransaction(IsolationLevel iso) +12 System.Data.SqlClient .SqlConnection.BeginDbTransaction(IsolationLevelisolationLevel) +60 System.Data。Common.DbConnection.BeginTransaction(IsolationLevel isolationLevel) +10 System.Data.EntityClient.EntityConnection.BeginDbTransaction(IsolationLevel isolationLevel) +83
为什么会这样?