System.Diagnostics.Process impersonating other user

后端 未结 2 738
日久生厌
日久生厌 2020-12-21 16:27

I have the following code which is working. My callback method is called with the program\'s output as it is generated.

var proc = new System.Diagnostics.Pr         


        
相关标签:
2条回答
  • 2020-12-21 16:49

    I spent almost 2 days to solve this problem... Here is the solution: http://forums.asp.net/p/1032763/3054483.aspx

    Briefly, you need to set the "App Pool's Identity" same as your "proc.StartInfo.UserName" and "proc.StartInfo.Password".

    You can either change the Identify of "DefaultAppPool" or create a new "App Pool" using your "proc.StartInfo.UserName" as the Identify.

    Of course, if you create a new "App Pool", you have to assign your asp.net web application use this "App Pool".

    Hope it's useful, good luck. lzch

    0 讨论(0)
  • 2020-12-21 16:50

    I think the problem is in security mechanism of UAC: your initial application have no rights to read output of the another user's process (even if it is a child process). Try to start your application with administrator privilegies and see if you code works.

    I think the best way to solve your problem is to redirect your child process output to a file and make a thread in your initial apllication to check that file for updates.

    Also found a similar problem Get error and standard output from an elevated child process

    0 讨论(0)
提交回复
热议问题