ESENT database engine file access denied

1.5k Views Asked by At

I am trying to using the ESENT windows database with the managedesent library but I always get the error

Error FileAccessDenied (JET_errFileAccessDenied, Cannot access file, the file is locked or in use)

The code to open the database is

m_Dictionary = new PersistentDictionary<string, PropertyStruct>("BaseEstateCachedPropertySummary2");

I am testing this on Windows 7 and the application is an ASP.NET application. Does anyone have any ideas about this, documentation is pretty slim.

2

There are 2 best solutions below

0
On BEST ANSWER

I found an answer. Apparently I didn't have write permissions to the default directory where it puts the database so I had to specify the full path such as.

m_Dictionary = new PersistentDictionary<string, PropertyStruct>(@"c:\Data\BaseEstateCachedPropertySummary2");
1
On

Are you trying to open an existing database used by another service (e.g. the Windows Update database)? Esent databases are single-process only so you have to stop any other processes that are using the same database.