从ASP.NET MVC调用应用程序

问题描述:

我试图查看是否可以从ASP.NET MVC应用程序调用外部(控制台)应用程序。它们都将在内部服务器上构建和部署,并且都将使用自定义的安全性形式,在执行任何操作之前通过VIA AD验证用户,因此Im不必过分担心安全风险。
基本上,我试图为应用程序构建基于Web的前端,以便可以在任何地方启动它。基于Web的前端将基本上收集所有参数,并在运行时将其传递给应用程序。

Im trying to see if it is at all possible to call an external (console) application from an ASP.NET MVC app. They will both be build and deployed on internal servers, and both will use a custom form of security, validating the user VIA AD before anything executes, so Im not overly worried about the security risks. Basically, Im trying to build a web based front end for an application so it can be kicked off "anywhere". The web based front end will basically collect all the parameters and pass them to the application at run time.

有什么想法吗?

创建 Process 对象,并在 ProcessStartInfo 中提供所有信息,然后只需启动该过程即可。

Create a Process object, and give all the information in the ProcessStartInfo, then just start the process.

类似的东西

        Process notepad = new Process();

        notepad.StartInfo.FileName = "notepad.exe";
        notepad.StartInfo.Arguments = "*.txt";

        notepad.Start();

当您为工作进程赋予足够的权限来启动该进程时,这是必须的。实际上,我们在其中一个应用程序中使用了相同的东西。

That's gotta work when you give your worker process enough rights to start the process. We actually use something the same in one of our applications.