tags:

views:

45

answers:

2

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.

+1  A: 

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.

Laurion Burchall
I am not trying to open an existing database like that. I have added the code above.
Craig
A: 

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");
Craig