【发布时间】:2017-05-12 18:11:22
【问题描述】:
我正在尝试解决一个看似分布式事务的问题:
异常消息:分布式事务已完成。要么入伍 此会话中的一个新事务或 NULL 事务。其他 错误:
System.Data.SqlClient.SqlException (0x80131904):分布式 交易完成。在新事务中登记此会话 或 NULL 交易。在 System.Data.SqlClient.SqlConnection.OnError(SqlException 异常, Boolean breakConnection, Action
1 wrapCloseInAction) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction) 在 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler、SqlDataReader 数据流、 BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean & dataReady) 在 System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(字符串 方法名,布尔异步,Int32 超时,布尔异步写入)在 System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 完成,字符串方法名,布尔型 sendToPipe,Int32 超时, 布尔 asyncWrite) 在 System.Data.SqlClient.SqlCommand.ExecuteNonQuery() 在 System.Data.Objects.ObjectContext.ExecuteStoreCommand(字符串 commandText,Object[] 参数)在 System.Data.Entity.Internal.InternalContext.ExecuteSqlCommand(字符串 sql, Object[] 参数)在 System.Data.Entity.Database.ExecuteSqlCommand(字符串 sql,对象 [] 参数)在 僧侣360.Data.Helpers.ChangeTrackingHelper.RecordUserConnection(DbContext 上下文,字符串用户名)在 d:\bld\9\117\Sources\Source\WEB\Source\monk360.Data\Helpers\ChangeTrackingHelper.cs:line 58
请密切注意上面的最后一行:
d:\bld\9\117\Sources\Source\WEB\Source\monk360.Data\Helpers\ChangeTrackingHelper.cs:58 行
如果我们查看代码,它会显示 Lien 58 只是一个没有代码的空行:
堆栈跟踪指向没有代码的行是什么意思?
【问题讨论】:
-
我想知道是否有过时的二进制文件。您一定已经完成了 clean-solution-restart-VS-Rebuild-All 例程?
-
你能分享一下 ChangeTrackingHelper.cs 从第 50 行到(最多)70 行的代码吗?
标签: c# sql .net sql-server visual-studio