I have a solution with 3 projects: a WPF application, a setup and a Windows service.
In the WPF application I have a Database.sdf
(SQL Server CE database) file. When the application is installed for example in folder X there is also the database.sdf
file in this folder.
Now my problem is: I want to connect to this database from the Windows service, how can I find out where the application was installed so I can get the path to the .sdf
file?
您可以在安装WPF应用程序的过程中在HKLM中写一个注册表项,其中包含数据库文件的路径,然后Windows Service可以读取此项。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.