从 Web 应用程序异步运行可执行文件(安全解决方案)

发布于 2024-08-29 09:40:12 字数 192 浏览 1 评论 0原文

用于在 IIS 托管 Web 应用程序下运行外部 EXE 或 BAT 文件的 System.Diagnostics API 的替代方案是什么? 我想从我的 ASP.NET-MVC Web 应用程序运行外部 EXE 程序。我不需要等到程序退出。我只想启动该程序。执行可能需要一些时间,或者可能会崩溃,因此我想将其与 IIS 分开运行,以便 Web 应用程序仅触发其执行。

What are the alternatives to System.Diagnostics API for running external EXE or BAT files under IIS hosted web application?
I would like to run external EXE program from my ASP.NET-MVC web application. I don't need to wait till the program exits. I just want to start the program. The execution can take some time or it may crash, so I would like to run it separatelly from IIS in such a way that the web application only triggers its execution.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

和我恋爱吧 2024-09-05 09:40:12

我曾经所做的是创建一个 WebService(无论如何,功能都封装在一个 WebService 中)并将方法指定为“OneWay”,这基本上是“Fire and Forget”。

http://msdn.microsoft.com/en- us/library/ms181848(v=vs.80).aspx

您的请求无需服务器响应。

当然,您需要编写自己的“通知”逻辑来让用户知道任务的成功/失败。

正如 @stefano 在评论中提到的,您可以使用诊断。

http://msdn.microsoft.com/en-us /library/system.diagnostics.process.start.aspx

由于它将位于 OneWay 设置中,因此您的 Web 应用程序在发出 HttpResponse 之前不会等待应用程序完成运行。

What I did once is create a WebService (the functionality was incapsulated in one anyways) and specified the method as "OneWay" which is basically a "Fire and Forget".

http://msdn.microsoft.com/en-us/library/ms181848(v=vs.80).aspx

Your request goes without expecting a response from the server.

Surely enough you need to code your own "notification" logic to let the user know the success / failure of the task.

As @stefano mentioned in the comments you can use the Diagnostics.

http://msdn.microsoft.com/en-us/library/system.diagnostics.process.start.aspx

Since it will be in the OneWay setup your web app won't wait for the app to finish running before issuing the HttpResponse.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文