Windows Services
-
i wrote this code to create a marker file("TMP.txt) on another PC. try { FileInfo TMPfile = new FileInfo(@"\\TERM1\\BOOTDRV\\TMP\\TMP.txt"); StreamWriter w = TMPfile.CreateText() ; w.Close(); } catch(Exception exp) { EventLog.WriteEntry(exp.Message); } Access to the path "\\Term1\\BOOTDRV\\TMP\\TMP.txt" is denied. i wrote the same code in Windows Application and it's creating tmp.txt on term1. ************* so with windows app i have access but not with windows services ????? Please need help.
-
i wrote this code to create a marker file("TMP.txt) on another PC. try { FileInfo TMPfile = new FileInfo(@"\\TERM1\\BOOTDRV\\TMP\\TMP.txt"); StreamWriter w = TMPfile.CreateText() ; w.Close(); } catch(Exception exp) { EventLog.WriteEntry(exp.Message); } Access to the path "\\Term1\\BOOTDRV\\TMP\\TMP.txt" is denied. i wrote the same code in Windows Application and it's creating tmp.txt on term1. ************* so with windows app i have access but not with windows services ????? Please need help.
sevan wrote: so with windows app i have access but not with windows services ????? Assign the service to run under a user that has the rights. xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots
-
i wrote this code to create a marker file("TMP.txt) on another PC. try { FileInfo TMPfile = new FileInfo(@"\\TERM1\\BOOTDRV\\TMP\\TMP.txt"); StreamWriter w = TMPfile.CreateText() ; w.Close(); } catch(Exception exp) { EventLog.WriteEntry(exp.Message); } Access to the path "\\Term1\\BOOTDRV\\TMP\\TMP.txt" is denied. i wrote the same code in Windows Application and it's creating tmp.txt on term1. ************* so with windows app i have access but not with windows services ????? Please need help.
Windows Services, by default, run under the Local System account, which has no rights to any network resources on any machine. If you want your service to be able to get to a shared network resource, you'll have to change the account that the service runs under. Right-click "My Computer" and click Manage. In the left pane of the MMC, expand Services and Applications. Click Services, then find your service in the right pane and double-click it. Click on the LogOn tab, then click on "This account". Type in the account name and password of an account that has permissions to the share you want the service to be able to get to, then click OK. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome