System.Diagnostics.Process impersonating other user

笑着哭i 提交于 2019-11-29 16:19:02

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

Dmitriy Konovalov

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!