c:\ProgramData 中存在安全违规?
我正在开发一个 SQL Compact 演示应用程序,我的安装项目所做的一件事是将 SDF 文件复制到用户的 c:\ProgramData
文件夹。但是,当应用程序在用户的计算机上运行时,我收到以下错误:
System.Data.EntityException:底层提供程序在打开时失败。 ---> System.Data.SqlServerCeException: 不允许访问数据库文件。 [文件名 = c:\ProgramData\Foresight Systems\SQL Compact Demo\LocalData.sdf]
我很困惑是什么导致了这个错误。 c:\ProgramData
不是此类文件的首选位置吗?我需要在我的设置项目中做什么才能使其正常工作?感谢您的帮助。
I am working on a SQL Compact demo app, 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我接受了 p.campbell 的回答,因为他指出了安全问题。我返回并查看了
c:\ProgramData
文件夹的“安全”选项卡,发现 Users 组对此文件夹仅有读取权限。因此,这可能不是放置 SDF 文件的最佳位置。我将发布一个关于文件放置位置的单独问题。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(?):