Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Windows Services

Windows Services

Scheduled Pinned Locked Moved C#
helpquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sevan
    wrote on last edited by
    #1

    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.

    L D 2 Replies Last reply
    0
    • S sevan

      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.

      L Offline
      L Offline
      leppie
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • S sevan

        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.

        D Offline
        D Offline
        Dave Kreskowiak
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups