Re: Process.Start() in windows service on Windows Server 2003, problem

From: Tobias Johansson (no)
Date: 02/25/05


Date: Fri, 25 Feb 2005 13:20:28 +0100

Hi again,

I've tried your suggestions below ;-)
And the programs start (ipconfig, other programs made in NET)
However, i think that you where right before that the program starts
(ExtExp.exe),
because i saw it for a millisecond in the taskmanager by coincidence.
Even though I never seen it before. (I have stared at the process tab before
when it was supposed to run but it never came up)

And the ntsd.exe server was unable to start debugging of the file.
However my colleague who made the program (ExtExp) put in a few more Logging
entries
and they actually showed up in the log.
so we have almost come to the conclusion that ExtExp.exe is setting some
working directories that
are mapped network drives.
And I assume that this won't work since it's running under the windows
service ?

Also tried debugging extexp with the ntsd
however when I tried to start the server i got this:

StartServer failed, HRESULT 0x80004005
    "Unspecified error"
ntsd: exiting - press enter ---

Thanks again for your time

"Pavel Lebedinsky" <m_pll at hotmail com> skrev i meddelandet
news:O%239PGgjGFHA.576@TK2MSFTNGP15.phx.gbl...
>I have lots of other ideas :)
>
> For example, does it work if you remove stdout redirection
> from the picture?
>
> Do you see process start/exit events for ExtExp.exe if you
> enable "Audit process tracking" in the Local Security Policy?
> You will need to run gpupdate after you change this setting.
> The events should be logged in the security event log with
> the category name of "Detailed tracking".
>
> What happens if you do this:
>
> ren ExtExp.exe ExtExp.exe.old
> copy %windir%\system32\ipconfig.exe .\ExtExp.exe
>
> then run your code again? Do you get output from ipconfig.exe?
>
> What happens if you run ExtExp.exe under debugger?
> Change your Process.Start call to use these settings:
>
> executable name: ntsd.exe
> parameters: -server tcp:port=12345 <full path to ExtExp.exe> <ExtExp
> parameters>
>
> When you call Process.Start with these settings you
> should see ntsd.exe and ExtExp.exe appear in Task Manager.
> ExtExp will be suspended in debugger. You can then attach
> to it like this:
>
> ntsd -remote tcp:server=localhost,port=12345
>
> Once you've attached to the remote session hit 'g' and see
> hat happens.
>
> "Tobias Johansson" wrote:
>
>> Thank you for your reply,
>>
>> I have tried both your suggestions,
>> but a can't get it to interact with the desktop. (no cmd window starts)
>> The cmd starts but not ExtExp.exe (monitored in task manager)
>>
>> And I get no exceptions running it in remote debug mode.
>>
>> I also made the extexp write to a log file the first thing it does..
>> nothing is in the log file after a run attempt .. wich means the program
>> never actually runs.
>>
>> If you have any other ideas, they are greatly appreciated.
>>
>> Thank you once again for your time.
>>
>>
>> "Pavel Lebedinsky" <m_pll at hotmail com> skrev i meddelandet
>> news:ujZs6GXGFHA.3732@tk2msftngp13.phx.gbl...
>>> So it looks like the process starts successfully but then terminates
>>> for some reason. May be it doesn't like the service environment
>>> or something like that.
>>>
>>> You could try configuring the service to run as System and enabling
>>> the "allow to interact with desktop" checkbox. Then you should be
>>> able to see your process window while it's running. If it goes away
>>> too quickly change the command line to something like
>>> "cmd /k test.cmd" and put the actual command in the test.cmd file.
>>>
>>> Another option is to run your process under the built in debugger
>>> (ntsd.exe) to see if you're getting any exceptions. You'll need to use
>>> the -server and -remote options to connect to the debugger session
>>> (unless you change your service to be interactive as described above).
>>>
>>> "Tobias Johansson" wrote:
>>>
>>>> I tested with notepad before and it worked,
>>>> but I can't actually see it because the program is running as a windows
>>>> service.
>>>>
>>>> However I tried it again today with the same result.
>>>> I also tried with ipconfig.exe and it worked without problem
>>>> and I got the output of my ip configuration in my log file.
>>>>
>>>> I also corrected the deadlock issue,
>>>> to read the stream before exit. Thanks pointing that out.
>>>>
>>>> I know win 2003 server has extra security on running exe files mapped
>>>> on network drives
>>>> but this is not on a mapped drive, it's local.
>>>> But coul'd it be related ? but then console program wouldn't have
>>>> worked either...?
>>>>
>>>> I have also tried setting the current work dir of the service to the
>>>> work dir where the exe is
>>>> before executing it .. no change..
>>>>
>>>> I have also checked the permissions on the file
>>>> and that the user that the service runs as has access to it (currently
>>>> as local admin just to make it work)
>
>



Relevant Pages

  • Could not find file
    ... I encountered a very weird siuation. ... I am debugging someone ... else's code, and in the code, it has a line that fopen a log file in a ... Michelle ...
    (comp.unix.questions)
  • RE: Logging
    ... \par The log file you mentioned includes some error message but may did not helpful for you to debugging. ...
    (microsoft.public.sharepoint.portalserver.development)
  • Re: Trace debugging in run-time (re-direct Debug.Print to a file?)
    ... Download DbgView from SysInternals and see you debugging info passing by. ... Note that I'm not redirecting you to a file-based logging as it has some overhead and possible issues as Windows doesn't update the log file every time you write a line to it. ...
    (microsoft.public.vb.general.discussion)
  • Re: [PATCH 00/10] Kernel memory leak detector 0.8
    ... I found in a log file. ... debugging but I don't think it is was causing the hang. ...
    (Linux-Kernel)