문제

I am creating a program that consists of a (1) Windows Service and a view (2) WPF Application. (the view and service do not have to be run at the same time) I will like to save all the settings on the same location. I was thinking to save all the settings on my application data directory. Because (1) and (2) are run by different users, Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) returns a different directory for each. How can I save both my wpf and windows service data on the same directory?

When I initialize my wpf application I will like to read some of the files created by my windows service. where should my windows service write files so that my wpf application can see them?

도움이 되었습니까?

해결책

You want CommonApplicationData, instead, the "common repository for all application-specific data that is used by all users," as MSDN puts it under SpecialFolder.

However, there are at least some cases where permissions conflict, so make sure the ACLs are set correctly.

This sample code may help.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top