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 Service.

Windows Service.

Scheduled Pinned Locked Moved C#
questionsysadminlinuxhelp
9 Posts 5 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.
  • A Offline
    A Offline
    Andre Stroebel
    wrote on last edited by
    #1

    Hi all, I have an urgent question. I am writing an windows service to retrieve files from a network drive mapped as Y: I get the following error... Could not find a part of the path "Y:\verify". When I run an Application it works fine, so I tried to shell the exe from my service, but still get the error! I have read and tried several things but to no success :( Can anyone please assist me? :sigh:

    P V A P 4 Replies Last reply
    0
    • A Andre Stroebel

      Hi all, I have an urgent question. I am writing an windows service to retrieve files from a network drive mapped as Y: I get the following error... Could not find a part of the path "Y:\verify". When I run an Application it works fine, so I tried to shell the exe from my service, but still get the error! I have read and tried several things but to no success :( Can anyone please assist me? :sigh:

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      The network drive is mapped to a particular user (yours I presume). It is highly unlikely that you are using your user for the service, so it won't be able to see the mapping because this is not present for the user. Your choices are: 1. Rewrite your code to use the UNC path. 2. Change the user of the service to your user. 3. Add the mapping to the user that the service runs against. Option 1 is your best option (oh, and don't hardcode the value - pick it up from a config file so that you can change it later on.)

      Deja View - the feeling that you've seen this post before.

      A 1 Reply Last reply
      0
      • A Andre Stroebel

        Hi all, I have an urgent question. I am writing an windows service to retrieve files from a network drive mapped as Y: I get the following error... Could not find a part of the path "Y:\verify". When I run an Application it works fine, so I tried to shell the exe from my service, but still get the error! I have read and tried several things but to no success :( Can anyone please assist me? :sigh:

        V Offline
        V Offline
        Vikram A Punathambekar
        wrote on last edited by
        #3

        This is most likely because your service is running under the local account. A local account is just that - local. You can either configure the service to run with a specific user's credentials (I've done this and it works) or use a UNC path (I haven't tried this, so I don't know).

        Cheers, विक्रम


        And sleep will come, it comes to us all And some will fade and some will fall

        A 1 Reply Last reply
        0
        • P Pete OHanlon

          The network drive is mapped to a particular user (yours I presume). It is highly unlikely that you are using your user for the service, so it won't be able to see the mapping because this is not present for the user. Your choices are: 1. Rewrite your code to use the UNC path. 2. Change the user of the service to your user. 3. Add the mapping to the user that the service runs against. Option 1 is your best option (oh, and don't hardcode the value - pick it up from a config file so that you can change it later on.)

          Deja View - the feeling that you've seen this post before.

          A Offline
          A Offline
          Andre Stroebel
          wrote on last edited by
          #4

          Thanx for the quick reply ;) If I use Option 1, the share uses Authentication. It's basically a DMZ share... How can I then authenticate the service? If I use Option 2, I have tried to set the Log On of the service to my domain logon, thought it would then see my mapped drive??? Under which ServiceAccount type should I install the service? Any advice here?

          1 Reply Last reply
          0
          • V Vikram A Punathambekar

            This is most likely because your service is running under the local account. A local account is just that - local. You can either configure the service to run with a specific user's credentials (I've done this and it works) or use a UNC path (I haven't tried this, so I don't know).

            Cheers, विक्रम


            And sleep will come, it comes to us all And some will fade and some will fall

            A Offline
            A Offline
            Andre Stroebel
            wrote on last edited by
            #5

            Hi thanx for the reply! I ran the service using my domain login, I thought that this will allow the service to see MY mapped drives. But still got the same error. Under which ServiceAccount should I then install,localService, Network Service? Please assist this is of great importance :)

            1 Reply Last reply
            0
            • A Andre Stroebel

              Hi all, I have an urgent question. I am writing an windows service to retrieve files from a network drive mapped as Y: I get the following error... Could not find a part of the path "Y:\verify". When I run an Application it works fine, so I tried to shell the exe from my service, but still get the error! I have read and tried several things but to no success :( Can anyone please assist me? :sigh:

              A Offline
              A Offline
              Andre Stroebel
              wrote on last edited by
              #6

              Hi all, thanx for the replies. I found a way to let a windows service access a mapped drive. I knew that only the user creating the network drive can see it, so the service would have to create a mapped drive in itself.... I found this great article, just compiled the class into a dll and used it in my service. Works great, so if any one has the same problem..... http://www.codeproject.com/csharp/mapnetdrive.asp?df=100&forumid=39622&select=2248704&msg=2248704[^]

              1 Reply Last reply
              0
              • A Andre Stroebel

                Hi all, I have an urgent question. I am writing an windows service to retrieve files from a network drive mapped as Y: I get the following error... Could not find a part of the path "Y:\verify". When I run an Application it works fine, so I tried to shell the exe from my service, but still get the error! I have read and tried several things but to no success :( Can anyone please assist me? :sigh:

                P Offline
                P Offline
                PIEBALDconsult
                wrote on last edited by
                #7

                Mapping drives is so '80s; use a UNC.

                E A 2 Replies Last reply
                0
                • P PIEBALDconsult

                  Mapping drives is so '80s; use a UNC.

                  E Offline
                  E Offline
                  ESTAN
                  wrote on last edited by
                  #8

                  the '80s were great, so mapping drives also ;-)

                  1 Reply Last reply
                  0
                  • P PIEBALDconsult

                    Mapping drives is so '80s; use a UNC.

                    A Offline
                    A Offline
                    Andre Stroebel
                    wrote on last edited by
                    #9

                    Mapping isnt so 80's when having to interface with DOS ;P

                    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