0

I have a windows service on XP OS in .Net Framework 2.0 which access folder and reads file from it to load it in database.
Shared folder has permission for "Everyone" with full control with all subfolder. and service runs on "Local System Account". and currently system running with Administrator account.
The stack trace is :

Message : Error while searching for files in : \\nw1\data\nov2012

Access to the path '\\nw1\data\nov2012' is denied.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.Directory.InternalGetFileDirectoryNames(String path, String userPathOriginal, String searchPattern, Boolean includeFiles, Boolean includeDirs, SearchOption searchOption)
   at System.IO.DirectoryInfo.GetFiles(String searchPattern, SearchOption searchOption)
   at System.IO.DirectoryInfo.GetFiles()
   at MyWinApp.Winservice1.SearchFiles(String imp, FileFolder objFile)

Edit: I found on MSDN that "LocalSystem Account has extensive privileges on the local computer" but not sure why it is not able to access network shared folder

can anyone suggest sollution for this problem?
Thanks,

par
  • 1,061
  • 1
  • 11
  • 29
  • Are you confident that both the network share and the local folder have the appropriate access permissions (E.G., allow Everyone full control)? – Kane Nov 01 '12 at 14:16
  • yes, i have double checked permissions on shared folder – par Nov 02 '12 at 05:57

2 Answers2

0

I searched on internet but everywhere i found that anyhow i have to provide username/password to provide proper permission to windows service to access network shared folder(directly to windows service property or in windows service code like given here, code in that thread is here).
so to make it working it for now i set username/password manually to service property.

Community
  • 1
  • 1
par
  • 1,061
  • 1
  • 11
  • 29
0

If you are running the service with a local account (I believe is windows what we are talking about) and that local account does not belong to the domain or a domain. You can always create the local account on the computer that is running the services AND create the local account on the computer that is sharing the folder. Same account name, same password. It will work