简体   繁体   中英

How to invoke an executable desktop application from within an ASP.NET MVC application?

I have finished developing an executable desktop application to generate a fractal image based on the passed-in arguments. The output type is JPEG.

Now I am developing a site under ASP.NET MVC 3. I want to use the executable from within my site.

Is it possible to use it as is without converting it to a class library and recompiling?

If you mean "to run on the user's machine", then not "as is" - you might want to look at Silverlight for that.

If you mean "to use at the server", then it will of course depend on how it operates (whether it prompts for input etc), and how it works (does it use GDI+, for example? that isn't recommended for use on web servers).

But sure; you can shell an exe with Process.Start , or if it is a .NET exe you can either add a reference directly to the exe and use it as a library (if it has appropriate code)

There is also a way to run it in-process via AppDomain.ExecuteAssembly - not sure this latter is a good idea on a web-server, though... especially if the exe talks to stdout .

For getting the image back to the client, you would want this processing to happen (perhaps with caching) in a route that uses return File(...); from MVC to simulate the image stream.

使用system.Diagonstics.Process类通过StartInfo对象调用exe以传递适当的参数。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM