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. Visual Basic
  4. Windows Service

Windows Service

Scheduled Pinned Locked Moved Visual Basic
questionsysadminlinuxhelp
9 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.
  • 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:

    G D A 3 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:

      G Offline
      G Offline
      GuyThiebaut
      wrote on last edited by
      #2

      Have you tried the UNC e.g. instead of : "Y:\somefile.txt" Try (depending on the path): "\\FredsComputer\C$\somefile.txt"

      You always pass failure on the way to success.
      A 1 Reply Last reply
      0
      • G GuyThiebaut

        Have you tried the UNC e.g. instead of : "Y:\somefile.txt" Try (depending on the path): "\\FredsComputer\C$\somefile.txt"

        You always pass failure on the way to success.
        A Offline
        A Offline
        Andre Stroebel
        wrote on last edited by
        #3

        Yes I have tried that, but the share needs authentication. So I get access denied error :(

        G 1 Reply Last reply
        0
        • A Andre Stroebel

          Yes I have tried that, but the share needs authentication. So I get access denied error :(

          G Offline
          G Offline
          GuyThiebaut
          wrote on last edited by
          #4

          Sounds like a permissions/user issue. I am not a networks expert and I guess someone else on this forum may be able to help. Good luck...

          You always pass failure on the way to success.
          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:

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

            A Windows Service runs, by default, as the Local System account, which has no rights to any network resources. The service does NOT run under the user context. It runs as if a seperate user logged into the machine (actually it DOES login to Windows) with no network permissions. To the service, there is no Y: drive. The only drives that exist are the local floppy, hard drive, and any CD/DVD drives. If you want the server to have access to the network, you have to change the account it's running under to one that has network permissions. Click Start/Run and type services.msc. Find your service in the list and double-click it. In the dialog that shows up, click the LogOn tab to change the account.

            A guide to posting questions on CodeProject[^]
            Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                 2006, 2007

            A 1 Reply Last reply
            0
            • D Dave Kreskowiak

              A Windows Service runs, by default, as the Local System account, which has no rights to any network resources. The service does NOT run under the user context. It runs as if a seperate user logged into the machine (actually it DOES login to Windows) with no network permissions. To the service, there is no Y: drive. The only drives that exist are the local floppy, hard drive, and any CD/DVD drives. If you want the server to have access to the network, you have to change the account it's running under to one that has network permissions. Click Start/Run and type services.msc. Find your service in the list and double-click it. In the dialog that shows up, click the LogOn tab to change the account.

              A guide to posting questions on CodeProject[^]
              Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                   2006, 2007

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

              Thanx for the reply. I have tried that approach but maybe i'm doing something wrong? I log in with a domain account, so in the service properties I specify my logon details. But then I run the service it can still not access my mapped drive :(( Got any idea why it would do this?

              D 2 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:

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

                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

                  Thanx for the reply. I have tried that approach but maybe i'm doing something wrong? I log in with a domain account, so in the service properties I specify my logon details. But then I run the service it can still not access my mapped drive :(( Got any idea why it would do this?

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

                  DO NOT CROSSPOST in multiple forums. It makes collaboration on an answer impossible. Did you map the drive by hand yourself at any time or did a login script do it for you?? If it wasn't through a login script, then the service will not see the mapped drive because it hasn't mapped it itself. Using mapped drives is a bit old-fashioned anyway. If you used UNC paths, you haven't have to worry about the mapping at all. The service still needs to run under a network account though.

                  A guide to posting questions on CodeProject[^]
                  Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                       2006, 2007

                  1 Reply Last reply
                  0
                  • A Andre Stroebel

                    Thanx for the reply. I have tried that approach but maybe i'm doing something wrong? I log in with a domain account, so in the service properties I specify my logon details. But then I run the service it can still not access my mapped drive :(( Got any idea why it would do this?

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

                    MaYo69 wrote:

                    Got any idea why it would do this?

                    Because the service logs in under its own security context. It's not aware that you logged in under the same account. It's completely in its own litte world. Nothing you do under your account will affect what the service sees.

                    A guide to posting questions on CodeProject[^]
                    Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                         2006, 2007

                    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