The problem is, my .NET Windows Service (running under NT AUTHORITY\SYSTEM
) creates a file in a folder inside ProgramData
, and the windows application gets a System.UnauthorizedAccessException
if it tries to overwrite it. Currently logged in user has an admin account, but the app doesn't start elevated (and I would like to avoid it).
If the service starts after the application, then the file is created by the UI app and it works fine. Is it possible to make a .NET Windows Service create a file which can be overwritten by a Windows app?