use*_*964 3 c# air asp.net process
我们有一个能够创建.air文件的asp.net应用程序.为此,我们使用以下代码:
System.Diagnostics.Process process = new System.Diagnostics.Process();
//process.StartInfo.FileName = strBatchFile;
if (File.Exists(@"C:\Program Files\Java\jre6\bin\java.exe"))
{
process.StartInfo.FileName = @"C:\Program Files\Java\jre6\bin\java.exe";
}
else
{
process.StartInfo.FileName = @"C:\Program Files (x86)\Java\jre6\bin\java.exe";
}
process.StartInfo.Arguments = GetArguments();
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.UseShellExecute = false;
process.PriorityClass = ProcessPriorityClass.Idle;
process.Start();
string strOutput = process.StandardOutput.ReadToEnd();
string strError = process.StandardError.ReadToEnd();
HttpContext.Current.Response.Write(strOutput + "<p>" + strError + "</p>");
process.WaitForExit();
Run Code Online (Sandbox Code Playgroud)
那么现在的问题是,有时服务器的CPU达到100%导致应用程序运行速度非常慢甚至丢失会话(我们认为这是问题).
关于如何生成空气文件或运行外部流程而不干扰asp.net应用程序,还有其他解决方案吗?
干杯,M.
问题在于:process.WaitForExit();,您只是暂停应用程序的执行.您可能希望使用线程来启动进程和某种IPC(进程间通信,如远程处理,命名管道)以了解生成何时完成.
| 归档时间: |
|
| 查看次数: |
437 次 |
| 最近记录: |