Security violation in c:\ProgramData?
I am working on a SQL Compact demo ap开发者_JAVA百科p, and one of the things I my setup project does is copy an SDF file to the user's c:\ProgramData
folder. However, when the app is run on the user's machine, I get the following error:
System.Data.EntityException: The underlying provider failed on Open. ---> System.Data.SqlServerCeException: Access to the database file is not allowed. [File name = c:\ProgramData\Foresight Systems\SQL Compact Demo\LocalData.sdf]
I am puzzled as to what's causing this error. Isn't c:\ProgramData
the preferred location for this sort of file? What do I need to do in my setup project to get this to work? Thanks for your help.
I accepted p.campbell's answer, because he identified the security issue. I went back and took a look at the Security tab for the c:\ProgramData
folder, and I discovered that the Users group only has read permissions for this folder. So, It's probably not the best place to put my SDF file. I'll post a separate question regarding where to put the file.
A few things to check perhaps(?):
- the .sdf has a file attribute of readonly
- is the application being run as administrator or UAC access being granted?
精彩评论