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. cannot launch exe from windows service??

cannot launch exe from windows service??

Scheduled Pinned Locked Moved C#
helptutorialquestion
5 Posts 2 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.
  • M Offline
    M Offline
    mdroz8
    wrote on last edited by
    #1

    ok, so i know it's some sort of permission problem i'm having, but i can't quite figure out what exactly i need to do to get this working. my windows service is starting a new Process object and launching an EXE. this exe is not getting called, but as a test i confirmed that i am able to launch things like notepad and perfmon from this service. i think i know what the problem is, but i just can't figure out how to fix it. my service is set to run under local system, and i believe the EXE i'm running is not running correctly because it needs resources that can only be accessed from the user account. is this correct? i've confirmed my code works by running the same code in a console app, and the exe successfully is called. it just won't get called from my exe! any ideas? thax!

    T 1 Reply Last reply
    0
    • M mdroz8

      ok, so i know it's some sort of permission problem i'm having, but i can't quite figure out what exactly i need to do to get this working. my windows service is starting a new Process object and launching an EXE. this exe is not getting called, but as a test i confirmed that i am able to launch things like notepad and perfmon from this service. i think i know what the problem is, but i just can't figure out how to fix it. my service is set to run under local system, and i believe the EXE i'm running is not running correctly because it needs resources that can only be accessed from the user account. is this correct? i've confirmed my code works by running the same code in a console app, and the exe successfully is called. it just won't get called from my exe! any ideas? thax!

      T Offline
      T Offline
      turbochimp
      wrote on last edited by
      #2

      Have you tried setting up the service to run as a specific user account, for instance the account you used to confirm that the EXE would start successfully? You should only do that as a test, by the way. If it does turn out to be a permission issue, a new account or group should be created with the least necessary permission(s) to use the EXE.

      The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’

      M 1 Reply Last reply
      0
      • T turbochimp

        Have you tried setting up the service to run as a specific user account, for instance the account you used to confirm that the EXE would start successfully? You should only do that as a test, by the way. If it does turn out to be a permission issue, a new account or group should be created with the least necessary permission(s) to use the EXE.

        The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’

        M Offline
        M Offline
        mdroz8
        wrote on last edited by
        #3

        yeah, i tried running it as the user that i run the exe manually successfully from. still doesn't work. i even tried setting it to networkservice, and that didn't even run at all cuz of permission issues... what else is there to try??

        T 1 Reply Last reply
        0
        • M mdroz8

          yeah, i tried running it as the user that i run the exe manually successfully from. still doesn't work. i even tried setting it to networkservice, and that didn't even run at all cuz of permission issues... what else is there to try??

          T Offline
          T Offline
          turbochimp
          wrote on last edited by
          #4

          Well, are you logging events on the service? If so, are there errors getting logged? Do you know for certain that the executable is not getting started? I don't know what it is you're trying to do, or what the executable is, so it's hard to make suggestions, but if you don't have some form of logging in place, then I would recommend adding some and seeing if anything comes of it. Good luck.

          The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’

          M 1 Reply Last reply
          0
          • T turbochimp

            Well, are you logging events on the service? If so, are there errors getting logged? Do you know for certain that the executable is not getting started? I don't know what it is you're trying to do, or what the executable is, so it's hard to make suggestions, but if you don't have some form of logging in place, then I would recommend adding some and seeing if anything comes of it. Good luck.

            The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’

            M Offline
            M Offline
            mdroz8
            wrote on last edited by
            #5

            i saw some winsock errors in the eveentlog associated with my service. theh exe i'm running is an exe that communicates with a server. so it opens up a tcp connection to a remote macine and sends some data... the fact that this is not easy to get working seems to be a GOOD thing, since this is typical action of some malicious service i would assume... i've spent a lot of time on this and i'm thinking it might be just easier to communicate with the natice c++ written in win32 code directly. then this way i would avoid haveing to spawn a new process and execute it, which is what's causing these security problems, right? so i can either covert this win32 exe into a DLL or a com object and talk to it using .net's com interop or dill importing attributes. which one is easier? -- modified at 11:00 Sunday 22nd January, 2006

            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