我有很简单的一段EF 查询代码:
var query = db.Etrans.Where(s => s.transactionId != null && s.crdate > checktime && s.transactionStatus == null).ToList();
但是有时会报错:
The underlying provider failed on Open.:
at System.Data.Entity.Core.EntityClient.EntityConnection.Open()
at System.Data.Entity.Core.Objects.ObjectContext.EnsureConnection(Boolean shouldMonitorTransactions)
at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess) at System.Data.Entity.Core.Objects.ObjectQuery1.<>c__DisplayClass41_0.<GetResults>b__0()
at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func1 operation) at System.Data.Entity.Core.Objects.ObjectQuery1.GetResults(Nullable1 forMergeOption) at System.Data.Entity.Core.Objects.ObjectQuery1.<System.Collections.Generic.IEnumerable<T>.GetEnumerator>b__31_0()
at System.Data.Entity.Internal.LazyEnumerator1.MoveNext() at System.Collections.Generic.List1..ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source)
at OneInc.OneIncService.UpdatePaymentStatus() in C:\Users\dhong\Documents\Projects\C#\VerifyOnlinePayments\VerifyOnlinePayments\OneIncService.cs:line 132
at OneInc.OneIncService.CheckDataByTransactionId(Boolean neednotifyCFP) in C:\Users\dhong\Documents\Projects\C#\VerifyOnlinePayments\VerifyOnlinePayments\OneIncService.cs:line 49
at TestOneIncAPI.Program.Main(String[] args) in C:\Users\dhong\Documents\Projects\C#\VerifyOnlinePayments\VerifyOnlinePayments\Program.cs:line 14
我不太会分析 StackTrace,所以请教这是什么原因造成的异常?