MVC 3: Menedżer transakcji MSDTC nie był w stanie pobrać transakcji ze źródła
Używam MVC 3 z Entities, teraz użyłem poniższej linii kodów z mojego kontrolera
<code> using (var scope = new TransactionScope()) { _myRepository.DeleteFM1(id); _myRepository.DeleteFM2(id, name); scope.Complete(); } </code>
i wewnątrz mojegoDeleteFM2 metoda, która jest moją metodą zdefiniowaną w klasie Entity, jest następująca:
<code> public void DeleteFM2(int id, string name) { var data= _repositoryMD.Fetch().Where(mColl => mColl.Col1 == id); if (data!= null) { //insert here is giving some error MSDTC error ! // here I prepare a message using the '**data**' _repositoryHistory.Insert(name, message, "FM2", "Delete", dateTime); _repositoryMD.Attach(data); _repositoryMD.Delete(data); _repositoryMD.SaveChanges(); } } } </code>
i mam oddzielną klasę, w której zdefiniowałem metodę Insert jako
<code> public bool Insert(string realName, string logMessage, string tableName, string changeType, DateTime dateTime) { var history = new History { ModifiedBy = realName, ChangeType = changeType, DateModified = dateTime, LogMessage = logMessage, TableName = tableName }; _repositoryHistory.Add(history); _repositoryHistory.SaveChanges(); return true; } </code>
Po wstawieniu tej linii kodu w powyższej metodzie DeleteFM2
<code> _repositoryHistory.Insert(name, message, "FM2", "Delete", dateTime); </code>
Dostaję ten błąd, bez tego kodu mój kod działa dobrze, użyłem tej linii we wszystkich moich innych metodach, nawet tam, gdzie korzystałem z Transaction Scope, ale wciąż nie rozumiem problemu tutaj. Proszę pomóż. Dzięki
Podstawowy dostawca nie powiódł się w Open.
System.Transactions.TransactionManagerCommunicationException: Komunikacja z podstawowym menedżerem transakcji nie powiodła się. ---> System.Runtime.InteropServices.COMException: Menedżer transakcji MSDTC nie mógł pobrać transakcji ze źródłowego menedżera transakcji z powodu problemów z komunikacją. Możliwe przyczyny: zapora sieciowa jest obecna i nie ma wyjątku dla procesu MSDTC, dwa komputery nie mogą znaleźć się nawzajem według nazw NetBIOS lub obsługa transakcji sieciowych nie jest włączona dla jednego z dwóch menedżerów transakcji. (Wyjątek od HRESULT: 0x8004D02B) w System.Transactions.Oletx.IDtcProxyShimFactory.ReceiveTransaction (UInt32 propgationTokenSize, Byte [] propgationToken, IntPtr managedIdentifier, Guid & transactionIdentifier, OletxTransactionIsolationLevel & isolationLevel, ITransactionShim & transactionShim) w System.Transactions.TransactionInterop.GetOletxTransactionFromTranactionInterop.GetOletxTransactionFromTranactionInterop.GetOletxTransactionFromTranactionInterop.GetOletxTransactionFromTranactionInterop.GetOletxTransactionFromTransmitterPropigationToken (Byte [] propagacyjnyToken) --- Koniec śledzenia wewnętrznego stosu wyjątków --- na System.Transactions.TransactionInterop.GetOletxTransactionFromTransmitterPropigationToken (Byte [] propagacyjnyToken) w System.Transactions.TransactionStatePSPEOperation.PSPEPromote (InternalTransaction tx) w System.Transactions.TransactionStateDelegatedBase w System.Transactions.TransactionStateDelegatedBase.Enteractions.TransactionStateDelegatedBase.Enteractions.TransactionStateDelegatedBase.Enteractions.TransactionStateDelegatedBase.Enteractions tx) w System.Transactions.EnlistableStates.Promote (InternalTransaction tx) w System.Transactions.Transaction.Promote () at System.Transactions.TransactionInterop.ConvertToOletxTransaction (Transakcja transakcji) w System.Transactions.TransactionInte rop.GetExportCookie (Transakcja transakcji, miejsca pobytu Byte []) w System.Data.SqlClient.SqlInternalConnection.GetTransactionCookie (Transakcja transakcji, Byte [] whereAbouts) w System.Data.SqlClient.SqlInternalConnection.EnlistNonNull (Transakcja tx) w System.Data. SqlClient.SqlInternalConnection.Enlist (Transaction tx) w System.Data.SqlClient.SqlInternalConnectionTds.Activate (Transaction transaction) at System.Data.ProviderBase.DbConnectionInternal.ActivateConnection (Transaction transaction) at System.Data.ProviderBase.DbConnectionPool.GetConnection (DbConnection owningObject ) w System.Data.ProviderBase.DbConnectionFactory.GetConnection (DbConnection owningConnection) w System.Data.ProviderBase.DbConnectionClosed.OpenConnection (DbConnection outerConnection, DbConnectionFactory connectionFactory) w System.Data.SqlClient.SqlConnection.Open () at System.Data.EntityClient .EntityConnection.OpenStoreConnectionIf (Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection ori ginalConnection, String wyjątek, String probedOperation, Boolean & closeStoreConnectionOnFailure)
Moje ustawienia FireWall