Which permissions are required to enable process.start via asp.net application? -
i have asp.net application uses process.start phone call executable (graphviz). works in development environment, when move production i'm not able process run. here's details.
i created simple sub show issue.
class="lang-vb prettyprint-override"> protected sub page_load(sender object, e eventargs) handles me.load dim processinfo processstartinfo processinfo = new processstartinfo 'processinfo.domain = "xxxxxxx" processinfo.username = "xxxxxx" dim pwdstring string = "xxxxxxx" dim newpass system.security.securestring newpass = new system.security.securestring each c char in pwdstring newpass.appendchar(c) next c processinfo.password = newpass 'processinfo.filename = """c:\windows\system32\notepad.exe""" 'processinfo.filename = """c:\test.bat""" processinfo.filename = """c:\program files (x86)\graphviz2.30\bin\dot.exe""" processinfo.arguments = " -kdot -tsvg c:\test.dot -pc:\test.svg" processinfo.redirectstandardoutput = true processinfo.useshellexecute = false processinfo.createnowindow = true dim process process process = new process process.startinfo = processinfo process.start() 'wait until process passes exit code process.waitforexit() seek dim processresults string = process.standardoutput.readtoend output.text = processresults grab ex exception output.text = ex.tostring end seek end sub there 3 scenarios here. first, testing starting notepad. - development works - production works (this case work in production)
second created simple batch file opens doc in notepad. (notepad c:\test.dot)
development works production not workthird, have calling graphviz's dot.exe. trying work in page.
development works production not workin of cases production not work can reproduce behavior - if add together impersonate = true web.config, not errors back. page runs if successful.
if don't add together impersonate config, add together credentials processinfo object, page 1 time again run without error. process not started in production, though.
if not add together impersonate or processinfo credentials, error. error output.
access denied
description: unhandled exception occurred during execution of current web request. please review stack trace more info error , originated in code.
class="lang-none prettyprint-override">exception details: system.componentmodel.win32exception: access denied source error: line 36: process = new process line 37: process.startinfo = processinfo line 38: process.start() line 39: line 40: 'wait until process passes exit code source file: c:\inetpub\vhosts\leapfrogbi.com\httpdocs\test\processstart.aspx.vb line: 38 stack trace: [win32exception (0x80004005): access denied] system.diagnostics.process.startwithcreateprocess(processstartinfo startinfo) +2161 system.diagnostics.process.start() +150 test_processstart.page_load(object sender, eventargs e) in c:\inetpub\vhosts\leapfrogbi.com\httpdocs\test\processstart.aspx.vb:38 system.web.ui.control.onload(eventargs e) +91 system.web.ui.control.loadrecursive() +74 system.web.ui.page.processrequestmain(boolean includestagesbeforeasyncpoint, boolean includestagesafterasyncpoint) +2207 i have tried variety of security related settings. app pool running identity local administrator. have tried adding administrators grouping in effort see if security root problem.
also, using plesk manage domain. have searched extensively options might affecting situation, , have found not yet. again, process start work in production when making simple phone call start notepad. hard narrow downwards without more verbose logs.
thank in advance help can offer. driving me nuts.
locate pool under witch site run, , see under witch user running.
if can not can run code see user pool running:
var user = system.security.principal.windowsidentity.getcurrent().user; var username = user.translate(typeof(system.security.principal.ntaccount)); and give permission user able run files.
reference: how find out business relationship asp.net code running under?
asp.net permissions process.start
No comments:
Post a Comment