Running an executable file asynchronously from a web application (safe solution)

What are the alternatives to the System.Diagnostics API for running external EXE or BAT files in an IIS web application? I would like to run an external EXE program from my ASP.NET-MVC web application. I do not need to wait for the program to exit. I just want to run the program. The execution may take some time or it may crash, so I would like to run it separately from IIS so that the web application only runs it.

+4
source share
1 answer

What I did once was to create a WebService (the functionality was encapsulated anyway) and indicated the method as "OneWay", which basically is "Fire and Forget."

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

Your request goes without waiting for a response from the server.

Of course, you need to encode your own β€œnotification” logic so that the user knows about the success / failure of the task.

As pointed out in the comments to @stefano, you can use Diagnostics.

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

Since this will be in OneWay setup, your web application will not wait for the application to complete before the release of HttpResponse.

0
source

Source: https://habr.com/ru/post/1306810/


All Articles