我有一个Web应用程序,该应用程序托管在带有Windows Server 2008的服务器计算机上的IIS7服务器上,该应用程序由执行.cmd文件组成,但它向我显示了以下错误
System.ComponentModel.win32exception (0x80004005): access is denied
en System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)
en System.Diagnostics.Process.Start()
en System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
en Ted.MNSProject.Reiniciar.Shutdown() en C:\Users\test\Desktop\Soluciones\MNS\Ted.MNS\Ted.MNSProject\Reiniciar.aspx.cs:línea 154
en Ted.MNSProject.Reiniciar.btnSiReiniciar_Click(Object sender,EventArgs e) en C:\Users\test\Desktop\Soluciones\MNS\Ted.MNS\Ted.MNSProject\Reiniciar.aspx.cs:línea 59
这是我的代码源
protected void btnSiReiniciar_Click(object sender,EventArgs e)
{
try
{
Shutdown();
Log2("MNS OK");
}
catch (Exception ex)
{
Log2("MNS ERROR " + ex.ToString());
}
}
public void Shutdown()
{
string pathBAT = "C:\\Users\\pc1\\Desktop\\restartWindows.cmd";
ProcessStartInfo startInfo = new ProcessStartInfo(pathBAT);
startInfo.Verb = "runas";
System.Diagnostics.Process.Start(startInfo);
}