Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.net windows service local application data is different then in normal app

In normal console app I have this

Environment.SpecialFolder.LocalApplicationData is C:\Users\Simon\AppData\Local\

In Windows service

Environment.SpecialFolder.LocalApplicationData is C:\Windows\system32\config\systemprofile\AppData\Local\

How can I specify same path in both type of application?

like image 749
Simon Avatar asked Nov 22 '10 16:11

Simon


1 Answers

Remember that the services run under a different user profile (can be a LOCAL_SERVICE, NETWORK_SERVICE, etc.) If you'd like them to be the same, run the service under your user profile (You can specify this ServiceProcessInstaller.Account property when you create the installer, or in the Services manager of windows).

like image 108
Brad Christie Avatar answered Nov 15 '22 19:11

Brad Christie