An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[SqlException (0x80131904): New transaction is not allowed because there are other threads running in the session.]\n System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +388\n System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +717\n System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +4515\n System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +84\n System.Data.SqlClient.TdsParser.TdsExecuteTransactionManagerRequest(Byte[] buffer, TransactionManagerRequestType request, String transactionName, TransactionManagerIsolationLevel isoLevel, Int32 timeout, SqlInternalTransaction transaction, TdsParserStateObject stateObj, Boolean isDelegateControlRequest) +1370\n System.Data.SqlClient.SqlInternalConnectionTds.ExecuteTransactionYukon(TransactionRequest transactionRequest, String transactionName, IsolationLevel iso, SqlInternalTransaction internalTransaction, Boolean isDelegateControlRequest) +796\n System.Data.SqlClient.SqlInternalConnection.BeginSqlTransaction(IsolationLevel iso, String transactionName, Boolean shouldReconnect) +585\n System.Data.SqlClient.SqlConnection.BeginTransaction(IsolationLevel iso, String transactionName) +263\n System.Data.SqlClient.SqlConnection.BeginDbTransaction(IsolationLevel isolationLevel) +197\n System.Data.EntityClient.EntityConnection.BeginDbTransaction(IsolationLevel isolationLevel) +151
New transaction is not allowed because there are other threads running in the session. hatasının çözümü nedir?
","headline":"New transaction is not allowed because there are other threads running in the session","mainEntity":{"@type":"Question","name":"New transaction is not allowed because there are other threads running in the session","url":"https://uzmanim.net/soru/new-transaction-is-not-allowed-because-there-are-other-threads-running-in-the-session/72148","author":{"@type":"Person","name":"alattin"},"comment":[],"commentCount":0,"dateCreated":"2016-10-20T15:32:37.39+03:00","dateModified":"2016-10-20T15:36:34.727+03:00","datePublished":"2016-10-20T15:32:37.39+03:00","keywords":["asp.net","asp.net mvc","entity framework","new transaction is not allowed","there are other threads running in the session"],"publisher":{"@type":"Organization","name":"uzmanim.net","url":"https://uzmanim.net"},"text":"Asp.Net MVC uygulamasında Entity Framework ile kaydetme işlemi yapmak istediğimde aşağıdaki hatayı alıyorum:
Server Error in '/' Application.
New transaction is not allowed because there are other threads running in the session.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: New transaction is not allowed because there are other threads running in the session.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[SqlException (0x80131904): New transaction is not allowed because there are other threads running in the session.]\n System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +388\n System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +717\n System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +4515\n System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +84\n System.Data.SqlClient.TdsParser.TdsExecuteTransactionManagerRequest(Byte[] buffer, TransactionManagerRequestType request, String transactionName, TransactionManagerIsolationLevel isoLevel, Int32 timeout, SqlInternalTransaction transaction, TdsParserStateObject stateObj, Boolean isDelegateControlRequest) +1370\n System.Data.SqlClient.SqlInternalConnectionTds.ExecuteTransactionYukon(TransactionRequest transactionRequest, String transactionName, IsolationLevel iso, SqlInternalTransaction internalTransaction, Boolean isDelegateControlRequest) +796\n System.Data.SqlClient.SqlInternalConnection.BeginSqlTransaction(IsolationLevel iso, String transactionName, Boolean shouldReconnect) +585\n System.Data.SqlClient.SqlConnection.BeginTransaction(IsolationLevel iso, String transactionName) +263\n System.Data.SqlClient.SqlConnection.BeginDbTransaction(IsolationLevel isolationLevel) +197\n System.Data.EntityClient.EntityConnection.BeginDbTransaction(IsolationLevel isolationLevel) +151
New transaction is not allowed because there are other threads running in the session. hatasının çözümü nedir?
","acceptedAnswer":{"@type":"Answer","name":"New transaction is not allowed because there are other threads running in the session. hatasının çözümü nedir?
Bu hata ile aşağıdaki gibi bir kod blogunuz varsa karşılaşabilirsiniz
foreach (var _p in db.kategoriler)\n {\n _p.HomePage = false;\n db.Save(_p);\n }
Yukarıdaki örnekteki gibi bir foreach döngüsü içindeyken kayıt yapamazsınız. foreach döngüsü aktif bir okuyucu üzerinden çalıştırıldığından dolayı hata verecektir.
Sorun ToList() ile çözülebilir:
db.kategoriler.ToList()
Bu şekilde ToList() ile artık veriyi çekmiş ve aktif okuma işlemini sonlandırmış olacaksınız.
","url":"https://uzmanim.net/soru/new-transaction-is-not-allowed-because-there-are-other-threads-running-in-the-session/72148#a72149","author":{"@type":"Person","name":"alattin"},"comment":[],"commentCount":0,"dateCreated":"2016-10-20T15:32:37.517+03:00","dateModified":"2016-10-20T15:32:37.517+03:00","text":"New transaction is not allowed because there are other threads running in the session. hatasının çözümü nedir?
Bu hata ile aşağıdaki gibi bir kod blogunuz varsa karşılaşabilirsiniz
foreach (var _p in db.kategoriler)\n {\n _p.HomePage = false;\n db.Save(_p);\n }
Yukarıdaki örnekteki gibi bir foreach döngüsü içindeyken kayıt yapamazsınız. foreach döngüsü aktif bir okuyucu üzerinden çalıştırıldığından dolayı hata verecektir.
Sorun ToList() ile çözülebilir:
db.kategoriler.ToList()
Bu şekilde ToList() ile artık veriyi çekmiş ve aktif okuma işlemini sonlandırmış olacaksınız.
","upvoteCount":0},"answerCount":1,"suggestedAnswer":{"@type":"Answer","name":"New transaction is not allowed because there are other threads running in the session. hatasının çözümü nedir?
Bu hata ile aşağıdaki gibi bir kod blogunuz varsa karşılaşabilirsiniz
foreach (var _p in db.kategoriler)\n {\n _p.HomePage = false;\n db.Save(_p);\n }
Yukarıdaki örnekteki gibi bir foreach döngüsü içindeyken kayıt yapamazsınız. foreach döngüsü aktif bir okuyucu üzerinden çalıştırıldığından dolayı hata verecektir.
Sorun ToList() ile çözülebilir:
db.kategoriler.ToList()
Bu şekilde ToList() ile artık veriyi çekmiş ve aktif okuma işlemini sonlandırmış olacaksınız.
","url":"https://uzmanim.net/soru/new-transaction-is-not-allowed-because-there-are-other-threads-running-in-the-session/72148#a72149","author":{"@type":"Person","name":"alattin"},"comment":[],"commentCount":0,"dateCreated":"2016-10-20T15:32:37.517+03:00","dateModified":"2016-10-20T15:32:37.517+03:00","text":"New transaction is not allowed because there are other threads running in the session. hatasının çözümü nedir?
Bu hata ile aşağıdaki gibi bir kod blogunuz varsa karşılaşabilirsiniz
foreach (var _p in db.kategoriler)\n {\n _p.HomePage = false;\n db.Save(_p);\n }
Yukarıdaki örnekteki gibi bir foreach döngüsü içindeyken kayıt yapamazsınız. foreach döngüsü aktif bir okuyucu üzerinden çalıştırıldığından dolayı hata verecektir.
Sorun ToList() ile çözülebilir:
db.kategoriler.ToList()
Bu şekilde ToList() ile artık veriyi çekmiş ve aktif okuma işlemini sonlandırmış olacaksınız.
","upvoteCount":0},"upvoteCount":0}}Asp.Net MVC uygulamasında Entity Framework ile kaydetme işlemi yapmak istediğimde aşağıdaki hatayı alıyorum:
Server Error in '/' Application.
New transaction is not allowed because there are other threads running in the session.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: New transaction is not allowed because there are other threads running in the session.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[SqlException (0x80131904): New transaction is not allowed because there are other threads running in the session.] System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +388 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +717 System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +4515 System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +84 System.Data.SqlClient.TdsParser.TdsExecuteTransactionManagerRequest(Byte[] buffer, TransactionManagerRequestType request, String transactionName, TransactionManagerIsolationLevel isoLevel, Int32 timeout, SqlInternalTransaction transaction, TdsParserStateObject stateObj, Boolean isDelegateControlRequest) +1370 System.Data.SqlClient.SqlInternalConnectionTds.ExecuteTransactionYukon(TransactionRequest transactionRequest, String transactionName, IsolationLevel iso, SqlInternalTransaction internalTransaction, Boolean isDelegateControlRequest) +796 System.Data.SqlClient.SqlInternalConnection.BeginSqlTransaction(IsolationLevel iso, String transactionName, Boolean shouldReconnect) +585 System.Data.SqlClient.SqlConnection.BeginTransaction(IsolationLevel iso, String transactionName) +263 System.Data.SqlClient.SqlConnection.BeginDbTransaction(IsolationLevel isolationLevel) +197 System.Data.EntityClient.EntityConnection.BeginDbTransaction(IsolationLevel isolationLevel) +151
New transaction is not allowed because there are other threads running in the session. hatasının çözümü nedir?
Toplam 1 cevap
New transaction is not allowed because there are other threads running in the session. hatasının çözümü nedir?
Bu hata ile aşağıdaki gibi bir kod blogunuz varsa karşılaşabilirsiniz
foreach (var _p in db.kategoriler)
{
_p.HomePage = false;
db.Save(_p);
}
Yukarıdaki örnekteki gibi bir foreach döngüsü içindeyken kayıt yapamazsınız. foreach döngüsü aktif bir okuyucu üzerinden çalıştırıldığından dolayı hata verecektir.
Sorun ToList() ile çözülebilir:
db.kategoriler.ToList()
Bu şekilde ToList() ile artık veriyi çekmiş ve aktif okuma işlemini sonlandırmış olacaksınız.