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. Deleting a file from windows service in c#

Deleting a file from windows service in c#

Scheduled Pinned Locked Moved C#
questioncsharphelp
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.
  • P Offline
    P Offline
    poqeqw
    wrote on last edited by
    #1

    Im trying to delete a file from windows service in c# file delete or fileinfo.delete and get Access to the path X is denied how can i solve this? Samele code will be greate help thanks

    P R 2 Replies Last reply
    0
    • P poqeqw

      Im trying to delete a file from windows service in c# file delete or fileinfo.delete and get Access to the path X is denied how can i solve this? Samele code will be greate help thanks

      P Offline
      P Offline
      Paul Conrad
      wrote on last edited by
      #2

      poqeqw wrote:

      Access to the path X is denied

      Sounds like a permission issue. Are you sure the permission is set right and the file is not open by another process?

      "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon

      1 Reply Last reply
      0
      • P poqeqw

        Im trying to delete a file from windows service in c# file delete or fileinfo.delete and get Access to the path X is denied how can i solve this? Samele code will be greate help thanks

        R Offline
        R Offline
        Rajasekharan Vengalil
        wrote on last edited by
        #3

        You might want to check the account under which the service is configured to run. Open "services.msc" and see the properties for your service on the "Log On" tab of the properties dialog. If it is "Local System account" and its a local file you're trying to delete (i.e. not a file on a network share) then you should certainly have permission. In that case it may be that the file has been locked by some other process. If it is some other user account then verify that that account has the required permission for the file.

        -- gleat http://blogorama.nerdworks.in[^] --

        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