使用实体框架,我昨晚在我的一个应用程序中收到了许多以下异常:
Using Entity Framework, I received a number of the following exceptions last night in one of my applications:
System.Data.EntityException: The underlying provider failed on Commit. --->
System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior
to completion of the operation or the server is not responding.
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
at System.Data.SqlClient.TdsParserStateObject.ReadSniError(TdsParserStateObject stateObj, UInt32 error)
at System.Data.SqlClient.TdsParserStateObject.ReadSni(DbAsyncResult asyncResult, TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParserStateObject.ReadNetworkPacket()
at System.Data.SqlClient.TdsParserStateObject.ReadBuffer()
at System.Data.SqlClient.TdsParserStateObject.ReadByte()
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler,SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.TdsExecuteTransactionManagerRequest(Byte[] buffer, TransactionManagerRequestType request, String transactionName, TransactionManagerIsolationLevel isoLevel, Int32 timeout, SqlInternalTransaction transaction, TdsParserStateObject stateObj, Boolean isDelegateControlRequest)
at System.Data.SqlClient.SqlInternalConnectionTds.ExecuteTransactionYukon(TransactionRequest transactionRequest, String transactionName, IsolationLevel iso, SqlInternalTransaction internalTransaction, Boolean isDelegateControlRequest)
at System.Data.SqlClient.SqlInternalConnectionTds.ExecuteTransaction(TransactionRequest transactionRequest, String name, IsolationLevel iso, SqlInternalTransaction internalTransaction, Boolean isDelegateControlRequest)
at System.Data.SqlClient.SqlInternalTransaction.Commit()
at System.Data.SqlClient.SqlTransaction.Commit()
at System.Data.EntityClient.EntityTransaction.Commit()
--- End of inner exception stack trace ---
at System.Data.EntityClient.EntityTransaction.Commit()
at System.Data.Objects.ObjectContext.SaveChanges(SaveOptions options)
at System.Data.Entity.Internal.InternalContext.SaveChanges()
at System.Data.Entity.Internal.LazyInternalContext.SaveChanges()
这个错误的有趣之处在于数据实际上已写入数据库.我在 MS 网站上找到了一篇相关帖子似乎表明这是与网络相关的错误.
What's interesting about this error is that the data was actually written to the database. I found a related post on a MS site that seemed to indicate that this was a network related error.
我可以寻求帮助的几个问题是:
A few questions that I could use assistance on are:
提前致谢.
更新
使用 Ignite for SQL 我们能够确定来自另一个组的辅助 SQL 进程正在垄断CPU 阻止我们的应用程序正常运行.简而言之,我们正在推进添加辅助服务器,以防止两个团队之间进一步发生冲突.
Using Ignite for SQL we were able to determine that a secondary SQL process from another group was monopolizing the CPU preventing our application from functioning properly. In short, we're moving forward with adding a secondary server to prevent further conflicts between the two teams.
关于异常仍然有趣的是,交易实际上成功而不是失败.
What's still interesting about the exception is that the transaction actually succeeded rather than failed.
我敢打赌,来自事务提交命令的成功响应未发送(或发送速度不够快)导致您的代码出现异常.一个有点疯狂的边缘案例.此类异常并不一定意味着命令的实际执行失败,只是存在A 失败.
My bet is that the success response from the transaction commit command was not sent (or not sent fast enough) causing an exception in your code. A kinda crazy edge case. Exceptions of this kind dont necessarily mean that the actual execution of the command failed just that there was A failure.
同样,如果从网络服务调用发送响应时出现问题,也不一定意味着没有应用该调用的任何副作用.
In the same way if there was a problem sending the response from a webservice call it wouldn't necessarily imply that any side effects of that call were not applied.
这篇关于System.Data.EntityException:底层提供程序提交失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
覆盖 == 运算符.如何与空值进行比较?Overriding == operator. How to compare to null?(覆盖 == 运算符.如何与空值进行比较?)
||(或)C# 中的 Linq 运算符The || (or) Operator in Linq with C#(||(或)C# 中的 Linq 运算符)
如何使用 .NET XmlSerializer 使值类型可以为空?How to make a value type nullable with .NET XmlSerializer?(如何使用 .NET XmlSerializer 使值类型可以为空?)
如何更改 .NET DateTimePicker 控件以允许输入空值?How to alter a .NET DateTimePicker control to allow enter null values?(如何更改 .NET DateTimePicker 控件以允许输入空值?)
检查空值的最短方法,如果不是,则分配另一个Shortest way to check for null and assign another value if not(检查空值的最短方法,如果不是,则分配另一个值)
string.Empty vs null.你使用哪个?string.Empty vs null.Which one do you use?(string.Empty vs null.你使用哪个?)