我们在测试机器上的实体框架代码中遇到了访问冲突。我想知道这是否可能是由于线程错误造成的,或者更可能是由于硬件问题造成的。
这是部分调用堆栈:
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at System.Data.Common.Internal.Materialization.CoordinatorFactory`1..ctor(Int32 depth, Int32 stateSlot, Expression hasData, Expression setKeys, Expression checkKeys, CoordinatorFactory[] nestedCoordinators, Expression element, Expression elementWithErrorHandling, Expression initializeCollection, RecordStateFactory[] recordStateFactories)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeConstructor(IRuntimeMethodInfo method, Object[] args, SignatureStruct& signature, RuntimeType declaringType)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(Type type, Object[] args)
at System.Data.Common.Internal.Materialization.CoordinatorScratchpad.Compile()
这种情况发生在 IIS 7 (Server 2008 R2 SP1) 上的 ASP.NET 应用程序中,使用 Entity Framework 4 访问 SQL Server 2008 R2。我读过关于EF 和 SQL Server CE 的访问冲突 http://brandonzeider.me/2011/microsoft-net/entity-frameworksql-server-ce-thread-safety/,但我们使用的是完整的 SQL Server。我们不直接与应用程序中的任何本机代码交互 - 没有 P/Invoke 或 COM 互操作。
这种事只发生过一次。就我个人而言,我认为这是机器的问题,而不是应用程序的问题......机器之前已经出现过几次蓝屏死机。但我被要求将其视为可能的错误进行调查。
如果再次发生这种情况,我将考虑设置 DebugDiag 来捕获此情况。有人还有其他建议吗?
Thanks,
Richard