2011-07-25 43 views
0

我们遇到了我们的测试机上访问冲突,在实体框架的代码。我想知道这是否可能是由于线程错误,或者更可能是由于硬件问题。访问冲突在实体框架代码访问SQL Server的

这里是部分调用堆栈:

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应用程序,使用实体框架4访问SQL Server 2008 R2。我读过有关access violations with EF and SQL Server CE,但我们使用的是完整的SQL Server。我们不直接与我们的应用程序中的任何本机代码进行交互 - 无需P/Invoke或COM互操作。

这仅发生过一次。就我个人而言,我认为这是机器的问题,而不是应用程序......机器曾经有过几次BSOD。但我被要求将其视为一个可能的错误。

我会考虑设立DebugDiag资料赶上这一点,如果它再次发生。有没有人有任何其他建议?


谢谢
理查德

回答

1

我想你可能是对的,我猜想,有在造成,导致此错误的内存损坏同一个工作进程中运行一些其他的代码。

如果在此工作进程运行其他应用程序,你可能想看看分离出来这个应用到一个专门的工人。除此之外,我会把它放入“让我们留意”类别。

+0

谢谢 - 好主意。在测试机上,它与其他一些测试应用程序一起运行在默认应用程序池中,但它们都应该是严格管理的代码。无论如何,将它分成自己的应用程序池可能是一个好主意。我们也会做一些硬件诊断。 –