November 9th, 2011, 09:23 AM
How should I install/run my service?
I'm having the following situation: I'm building an application that requires a service. The service is sometimes creating files and folders, for the user (it actually receives the files, which it then writes on disk).
My problems are the following ones:
1. If a "Standard User" (ie non-admin) uses the application (which includes the service), the files that the service creates cannot be even read by this user, because he has no privileges, as it seems ("access is denied"). But the same files can afterwards be seen by the admin users.
2. If the service is creating for the Administrator user a folder on the desktop (I haven't tried with a destination like C:\), then then the admin user cannot even see the folder, because of the privileges (the folder does not appear, but it gets nonetheless into the list if I use the "dir" command in cmd; while if I stop the service, the folder automatically gets deleted - I have no idea why). However, I have tried to make the service create a folder in a folder on the desktop (folder that had been already been created by myself before), and it worked correctly.
So I understand that the problem with the service has something to do with how it is installed/ran as. Currently, it is on "LocalSystem" (I have tried to install it using the cmd with the sc.exe command with "LocalService" but it does not recognize the "LocalService").
So, is there a way I can make my service create files and folders for users to read/write them as they wish?
If yes, then PLEASE TELL ME how to do it.
P.S. So far I have used a .bat file to call the sc.exe for installing and starting the service. Is it ok?
Last edited by Feoggou; November 9th, 2011 at 09:25 AM.
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!