Search code examples
c#.netesent

ESENT database engine file access denied


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.


Solution

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