IIS SQL Server Compact 4.0 SP1

248 views Asked by At

I've been using SQL Server Compact Edition 4.0 SP1 with Entity Framework for data access in one of our web applications for the past couple of years without problems, but in the last couple of days I've been getting errors when attempting to run the application locally from within IIS.

The error I'm getting is, unfortunately, not very helpful:

System.Data.SqlServerCe.SqlCeException: Unspecified error [ sqlcese40.dll ]

[EntityException: The underlying provider failed on Open.]

As I had just checked out a branch into a new directory, at first I thought the issue was caused by permissions, but granting the application pool read/write access did not fix it.

I tried a number of other things, uninstalling and reinstalling SQL Server CE etc... but this didn't fix the issue either.

Finally, I changed the "Enable 32-bit Applications" setting for the app pool to true and this "fixed" the issue and I was able to get the application running again.

I'm not satisfied with this solution however, as I've been running without this enabled for months without any problem and I want to figure out what has caused the issue but I'm a bit stumped as where to look next.

Just wondered if anyone had any suggestions?

Here is the full error from the Event Log:

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)
0

There are 0 answers