配置GUI部署,放在同一目录下吗? C#

发布于 2024-11-28 12:01:59 字数 178 浏览 2 评论 0原文

我正在编写一个 GUI 来配置用 C#.NET 3.5 编写的服务,它编辑嵌入式 SQLite 数据库,服务从中提取其设置。 GUI 是在一个单独的项目中开发的,我现在想集成它们。这是我第一次实现这样的事情,我不确定我该如何去做。

我是否只需将 GUI .exe 文件放在与服务相同的目录(bin?)中并为其提供数据库的位置?

I am writing a GUI to configure my service written in C#.NET 3.5, it edits an embedded SQLite database from which the service pulls its settings. The GUI is being developed in a seperate project and I am at the point where I would like to integrate them. It is my first time implementing someting like this and I am unsure how I go about it.

Do I simply place the GUI .exe file in the same directory (bin?) as the service and give it the location of the database?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

半透明的墙 2024-12-05 12:01:59

是的,通常。但是,您必须请求提升,否则您将无法写入数据库。 UAC 阻止对 c:\program files 中的目录进行写访问。这没关系,毕竟用户正在修改特权服务的配置。您可能需要停止并启动服务才能使配置更改生效,这只能通过特权程序来完成。在 gui.exe 中嵌入清单,如 这篇文章

先解决下一个问题:没有标准的 Windows 方法可以将 dbase 存储在服务和 GUI 都可以访问的位置,而无需提升。您必须编写一个安装程序来创建一个目录,为 gui 应用程序提供足够的权限,并允许服务在不依赖用户名的情况下找到该目录。

Yes, usually. You will however have to ask for elevation or you won't be able to write to the dbase. UAC prevents write access to the directories in c:\program files. Which is okayish, the user is after all tinkering with the configuration of a privileged service. And you probably need to stop and start the service to make the configuration change effective, something you can only do from a privileged program. Embed a manifest in gui.exe as explained in this post.

Pre-empting the next question: there is no standard Windows way to have to dbase in a location that's accessible to both the service and your gui without elevation. You'd have to write an installer that creates a directory that gives the gui app sufficient rights and allows the service to find the directory without relying on the user name.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文