简体   繁体   English

从Web应用程序调用(.exe)控制台应用程序时,命令提示符不会打开c#

[英]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.

相关问题 从C#Web应用程序中的命令提示符处执行命令 - Execute commands from command prompt in c# web application C#Winforms应用程序从命令提示符和调试器中打开,但不能从文件资源管理器中打开 - C# Winforms application opens from Command Prompt and in debugger, but not from File Explorer 从 C# 控制台应用程序调用 Web 服务 - Calling a web service from the C# console application 使用命令提示符中的参数执行C#控制台应用程序 - Execute a C# console application with parameters in command prompt C#控制台应用程序保存Excel文件(不提示) - C# console application save excel file (do not prompt) C# 控制台应用程序:有没有办法检测 exe 是否从命令行运行? - C# Console Application: Is there a way to detect whether the exe was run from a command line or not? 如何获取C#控制台应用程序的.exe名称? - How do I get the .exe name of a C# console application? 在运行命令提示符.exe应用程序时,将C#WPF应用程序中的特定行定义为超时 - Define timeout to specific line in C# WPF application while running command prompt .exe application 如何在C#Web应用程序中运行命令工具exe? - How to run a command tool exe in C# web application? 从命令提示符运行控制台应用程序 - Run console application from the command prompt
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM