开发者

Running executable asynchronously from web application (safe solution)

开发者 https://www.devze.com 2022-12-27 05:45 出处:网络
What are the alternatives to System.Diagnostics API for running external EXE or BAT files under IIS hosted web application?

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 appli开发者_Go百科cation. 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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消