我过去几年一直在使用SQL Server Compact Edition 4.0 SP1和Entity Framework在我们的某个Web应用程序中进行数据访问而没有任何问题,但在过去的几天里我一直在使用尝试从IIS中本地运行应用程序时收到错误。
遗憾的是,我得到的错误不是很有用:
System.Data.SqlServerCe.SqlCeException:未指定错误[sqlcese40.dll]
[EntityException:底层提供程序在Open上失败。]
由于我刚刚将一个分支检出到一个新目录,起初我认为该问题是由权限引起的,但是授予应用程序池读/写访问权限并没有解决它。
我尝试了许多其他的东西,卸载并重新安装SQL Server CE等......但这并没有解决问题。
最后,我改变了"启用32位应用程序"将应用程序池的设置设置为true,这个"已修复"问题和我能够让应用程序再次运行。
我对这个解决方案并不满意,因为我已经运行了几个月而没有任何问题我想知道是什么导致了这个问题,但是我有点难过如下所示。
只是想知道是否有人有任何建议?
以下是事件日志中的完整错误:
Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 03/10/2016 12:39:00
Event time (UTC): 03/10/2016 11:39:00
Event ID: a0a208f33d6a4435a26d41aebf98e9a1
Event sequence: 2
Event occurrence: 1
Event detail code: 0
Application information:
Application domain:
Trust level: Full
Application Virtual Path:
Process information:
Process ID: 752
Process name: w3wp.exe
Account name: IIS APPPOOL\XXX
Exception information:
Exception type: EntityException
Exception message: The underlying provider failed on Open.
at System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure)
at System.Data.EntityClient.EntityConnection.Open()
at System.Data.Objects.ObjectContext.EnsureConnection()
at System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
at System.Data.Objects.ObjectQuery`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator()
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
at System.Data.Entity.Internal.EdmMetadataRepository.QueryForModelHash(Func`2 createContext)
at System.Data.Entity.Internal.ModelCompatibilityChecker.CompatibleWithModel(InternalContext internalContext, ModelHashCalculator modelHashCalculator, Boolean throwIfNoMetadata)
at System.Data.Entity.CreateDatabaseIfNotExists`1.InitializeDatabase(TContext context)
at System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action)
Unspecified error [ sqlcese40.dll ]
at System.Data.SqlServerCe.SqlCeConnection.Open(Boolean silent)
at System.Data.SqlServerCe.SqlCeConnection.Open()
at System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure)
Request information:
Request URL: -
Request path: -
User host address: ::1
User:
Is authenticated: False
Authentication Type:
Thread account name: -
Thread information:
Thread ID: 7
Thread account name: -
Is impersonating: False
Stack trace: at System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure)
at System.Data.EntityClient.EntityConnection.Open()
at System.Data.Objects.ObjectContext.EnsureConnection()
at System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
at System.Data.Objects.ObjectQuery`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator()
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
at System.Data.Entity.Internal.EdmMetadataRepository.QueryForModelHash(Func`2 createContext)
at System.Data.Entity.Internal.ModelCompatibilityChecker.CompatibleWithModel(InternalContext internalContext, ModelHashCalculator modelHashCalculator, Boolean throwIfNoMetadata)
at System.Data.Entity.CreateDatabaseIfNotExists`1.InitializeDatabase(TContext context)
at System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action)