我们最近将.net项目移动到.net核心并让它在docker容器中运行。由于这样做,我在保存新实体的更改时偶然会从实体框架中得到错误。在任何情况下,实体都没有任何相关对象。它只是在数据库中创建一个新的单个记录。
遗憾的是,错误消息对我没有多大意义,我不知道从哪里开始寻找。因为在我想知道它是否与某个docker容器或迁移到.net核心之间存在联系之前它没有做到这一点。错误消息是......
System.Data.SqlClient.SqlException(0x80131904):传输级别 从服务器接收结果时发生错误。 (服务提供商: TCP提供程序,错误:0 - 成功)at System.Data.SqlClient.SqlConnection.OnError(SqlException异常, 布尔值breakConnection,Action
1 wrapCloseInAction) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action
1 wrapCloseInAction)at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj,Boolean callerHasConnectionLock,Boolean asyncClose)at System.Data.SqlClient.TdsParserStateObject.ReadSniError(TdsParserStateObject stateObj,UInt32错误)at System.Data.SqlClient.TdsParserStateObject.ReadSniSyncOverAsync()at System.Data.SqlClient.TdsParserStateObject.TryReadNetworkPacket()at System.Data.SqlClient.TdsParserStateObject.TryPrepareBuffer()at System.Data.SqlClient.TdsParserStateObject.TryReadByte(Byte& value)at at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler,SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler,TdsParserStateObject stateObj,布尔& dataReady)at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler,SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler,TdsParserStateObject stateObj)at System.Data.SqlClient.TdsParser.TdsExecuteTransactionManagerRequest(字节[] buffer,TransactionManagerRequestType请求,String transactionName, TransactionManagerIsolationLevel isoLevel,Int32超时, SqlInternalTransaction事务,TdsParserStateObject stateObj)at System.Data.SqlClient.SqlInternalConnectionTds.ExecuteTransactionYukon(TransactionRequest transactionRequest,String transactionName,IsolationLevel iso, SqlInternalTransaction internalTransaction)at System.Data.SqlClient.SqlInternalConnectionTds.ExecuteTransaction(TransactionRequest transactionRequest,String name,IsolationLevel iso, SqlInternalTransaction internalTransaction)at System.Data.SqlClient.SqlInternalConnection.BeginSqlTransaction(的IsolationLevel iso,String transactionName,Boolean shouldReconnect)at System.Data.SqlClient.SqlConnection.BeginTransaction(的IsolationLevel iso,String transactionName)at System.Data.SqlClient.SqlConnection.BeginDbTransaction(的IsolationLevel isolationLevel)at System.Data.Common.DbConnection.BeginTransaction(的IsolationLevel isolationLevel)at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.BeginTransactionWithNoPreconditions(的IsolationLevel isolationLevel)at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.BeginTransaction(的IsolationLevel isolationLevel)at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.BeginTransaction() 在 Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.Execute(元组2 parameters) at Microsoft.EntityFrameworkCore.Storage.Internal.SqlServerExecutionStrategy.Execute[TState,TResult](TState state, Func
3操作,Func3 verifySucceeded) at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.Execute(IEnumerable
1 commandBatches,IRelationalConnection连接)at Microsoft.EntityFrameworkCore.Storage.RelationalDatabase.SaveChanges(IReadOnlyList1 entries) at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(IReadOnlyList
1 entriesToSave)at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(布尔 acceptAllChangesOnSuccess)at Microsoft.EntityFrameworkCore.DbContext.SaveChanges(布尔 acceptAllChangesOnSuccess)at Microsoft.EntityFrameworkCore.DbContext.SaveChanges()at TEAPI.Domain.Data.Repositories.EventLogRepository.LogEvent(EventLogEvent eventLogEvent)in /home/web/buildAgent/work/35649df7ceb7c251/src/TEAPI.Domain/Data/Repositories/EventLogRepository.cs:line 52在TEAPI.Controllers.EventLogController.LogSalesEvent()中 /home/web/buildAgent/work/35649df7ceb7c251/src/TEAPI/Controllers/EventLogController.cs:line 27点 Microsoft.Extensions.Internal.ObjectMethodExecutor<> c__DisplayClass33_0.b__0(对象 target,Object []参数)at Microsoft.Extensions.Internal.ObjectMethodExecutor.Execute(对象 target,Object []参数)at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.d__12.MoveNext() ---从抛出异常的先前位置开始的堆栈跟踪结束--- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务 任务) Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.d__10.MoveNext() ---从抛出异常的先前位置开始的堆栈跟踪结束--- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext 上下文) Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(州及放大器; 接下来,范围&范围,对象& state,Boolean& isCompleted)at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.d__14.MoveNext() ---从抛出异常的先前位置开始的堆栈跟踪结束--- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务 任务) Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.d__22.MoveNext()--- 从抛出异常的先前位置开始的堆栈跟踪结束 ---在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext 上下文) Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, 适用范围和放大器;范围,对象& state,Boolean& isCompleted)at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.d__17.MoveNext()--- 从抛出异常的先前位置开始的堆栈跟踪结束 ---在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务 任务) Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.d__15.MoveNext()--- 从抛出异常的先前位置开始的堆栈跟踪结束 ---在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务 任务)在Microsoft.AspNetCore.Builder.RouterMiddleware.d__4.MoveNext() ---从抛出异常的先前位置开始的堆栈跟踪结束--- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务 任务)在TEAPI.Middleware.ExceptionHandlingMiddleware.d__3.MoveNext() 在 /home/web/buildAgent/work/35649df7ceb7c251/src/TEAPI/Middleware/ExceptionHandlingMiddleware.cs:line 26 ClientConnectionId:72a861d4-e94c-4175-9249-bdca4a2b83a0