[英]command prompt do not opens up when calling (.exe) console application from web application c#
i am using this function from my web application to call exe file . 我在我的Web应用程序中使用此函数来调用exe文件。 when it calls .exe file every thing happens accurately, i can see it as running process in task manager processes, but why dont the command prompt opens up when this process is called.
当它调用.exe文件时,每个事情都准确地发生,我可以在任务管理器进程中将其视为正在运行的进程,但是为什么在调用此进程时不会打开命令提示符。
the web application is hosted on iis of same system. Web应用程序托管在同一系统的iis上。
public void RunconsoleApplication(string Id)
{
// Get the file path of your Application (exe)
string filePath = @"E:/ConsoleApplication1/ConsoleApplication1/bin/Debug/ConsoleApplication1.exe";
System.Diagnostics.ProcessStartInfo info = new System.Diagnostics.ProcessStartInfo(filePath, Id);
System.Diagnostics.Process p = System.Diagnostics.Process.Start(info);//called
}
updated 更新
when run the same application on visual atudio, the command prompt is opened. 在visual atudio上运行相同的应用程序时,将打开命令提示符。 but it dont when hosted on iis
但它不会在iis上托管
IIS and its child processes are running in different (and windowless) session. IIS及其子进程在不同(和无窗口)会话中运行。 So you can't see if window is open.
所以你看不到窗户是否打开。 Also some processes may behave strangly due this (you probably did not hit such issues, and unlikly to have problems with console apps).
此外,某些进程可能因此而表现得很糟糕(您可能没有遇到过这样的问题,而且对控制台应用程序有问题)。
You can see it by turning on "Session ID" column in task manager: View -> Select columns-> Session ID (on processes tab). 您可以通过打开任务管理器中的“会话ID”列来查看它:查看 - >选择列 - >会话ID(在进程选项卡上)。
Have you tried setting the window style to Maximized? 您是否尝试将窗口样式设置为最大化?
ProcessStartInfo startInfo = new ProcessStartInfo("IExplore.exe");
startInfo.WindowStyle = ProcessWindowStyle.Maximized;
Process.Start(startInfo);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.