ASP.NET进程开始PowerShell脚本IIS 7.5 [英] ASP.NET Process Start PowerShell Script IIS 7.5
问题描述
所有的作品在我的dev的机器上正常,但如果部署到IIS进程不上手。我对
All works fine on my dev machine but if deployed to IIS the process doesn't get started. I am starting a powershell script by
private void RunScript()
{
Process process = null;
try
{
int timeout = 1800000;
var startInfo = new ProcessStartInfo
{
FileName = @"powershell.exe",
Arguments = string.Format("{0} {1}", "\path\toscript", "myParam"),
UseShellExecute = false,
CreateNoWindow = true
};
process = Process.Start(startInfo);
process.WaitForExit(timeout);
}
finally
{
if (!process.HasExited)
{
if (process.Responding)
process.CloseMainWindow();
else
process.Kill();
}
if (process != null)
{
process.Close();
process.Dispose();
}
}
}
下面是什么配置这下运行的应用程序池。
Here's what's configured for the app pool this is running under.
流程模型
- >身份=域用户谁是域管理员。
- >加载用户配置文件= TRUE
Process Model
->Identity = domain user who is a Domain Admin.
->Load User Profile = True
Web应用程序
认证是windows
Web App
Authentication is Windows
还有什么我需要配置,这样我可以运行进程?
What else do I need to configure to so that I can run the Process?
推荐答案
这是更好的嵌入的PowerShell的API调用中的.exe
It's much better to embed the PowerShell APIs the call the .exe
下面是一个旧的链接,将让你嵌入在每个用户的ASP.NET PowerShell的运行空间:
Here's an old link that will get you a PowerShell runspace embedded in ASP.NET per user:
http://powershellpipeworks.com/Write-AspNetScriptPage
这篇关于ASP.NET进程开始PowerShell脚本IIS 7.5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!