EntityException:不允许访问数据库文件
我正在开发一个 Visual Sudio 2010 安装项目来安装实体框架/SQL Compact 应用程序。该应用程序需要在用户的计算机上安装 SDF 文件。据我了解 Microsoft 指南,我应该将 SDF 文件安装到用户计算机上 C:\ProgramsData 下的 company\application 子文件夹中,这是我在安装项目中通过在文件系统编辑器中使用 DefaultLocation 创建自定义文件夹来完成的[CommonAppDataFolder] 的属性。一切正常,SDF 文件安装到 C:\ProgramData\MyCompany\MyApp\MyFile.sdf。
这是我的问题:在客户端计算机上,我的应用程序抛出 EntityException 并显示以下消息:“SqlCeException:不允许访问数据库文件。”听起来像是权限问题。
有没有办法在 VS 安装项目中设置 SDF 安装文件夹的权限?我该怎么做呢?有什么例子吗?感谢您的帮助。
I am working on a Visual Sudio 2010 Setup Project to install an Entity Framework / SQL Compact app. The app needs to install an SDF file on the user's machine. As I understand the Microsoft guidance, I should install the SDF file to a company\application subfolder under C:\ProgramsData on the user's machine, which I have done in the setup project by creating a custom folder in the File System Editor with a DefaultLocation property of [CommonAppDataFolder]. All works well, and the SDF file is installed to C:\ProgramData\MyCompany\MyApp\MyFile.sdf.
Here is my problem: On the client machine, my app is throwing an EntityException with the following message: "SqlCeException: Access to the database file is not allowed." Sounds like a permissions issue.
Is there a way to set permissions on the SDF installation folders from within a VS Setup project? How would I do it? Any examples? Thanks for your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
答案是创建一个小型 DLL,由 Visual Studio 安装项目作为自定义操作执行。 此处提供了有关创建自定义操作的演练。
The answer is to create a small DLL that gets executed as a Custom Action by the Visual Studio Setup Project. There is a walkthrough on creating Custom actons here.