我有一个asp代码:
protected void Button1_Click(object sender, EventArgs e)
{
try
{
Response.Write("Windows Account which runs ASP.NET is: "
+ Environment.UserName);
System.Diagnostics.Process process1 = new System.Diagnostics.Process();
process1.StartInfo.WorkingDirectory = Request.MapPath("~/");
process1.StartInfo.UseShellExecute = false;
process1.StartInfo.FileName = Request.MapPath("update.bat");
process1.Start();
process1.WaitForExit();
Response.Write("Done");
}
catch (Exception ex)
{
Response.Write("Error" + ex.ToString());
}
}
test.bat内容为:
"O:\Program Files\QlikView\Qv.exe" /r "C:\inetpub\wwwroot\AMLCM\Qv\Proj\Project1.qvw"
IIS配置设置为
检查IIS管理服务“允许服务与桌面交互”。应用程序池标识设置为“ApplicationPoolIdentity”
DefaultapplicationPool可以完全控制网站 update.bat与网站
在同一个文件夹中在web.config上我输入了以下代码:
<identity impersonate="true" userName="hosein" password="apass" />
在machine.config上的我添加了下面的代码
<processModel autoConfig="true" userName="hosein" password="apass" />
cmd程序正在破坏背景,但它没有显示任何东西