views:

18

answers:

1

Hi all,

I want to develop a web application using ASP.NET running on IIS.

If a user submits a MAXIMA input command, the code behind will ask a custom windows service to create a new distinct temporary process executing an external assembly.

More precisely, there is only one windows service serving for all users, but each user will be associated with a distinct, temporary process running an external assembly.

The windows service contains a single socket listening on a certain port and a list of asynchronous sockets for communication. Each socket of the list will communicate with a distinct, temporary process running an external assembly which works as a client socket.

Note that: I use a process rather than an application domain because the external assembly is a batch file (not managed assembly).

My questions are:

  1. How to call windows service from code behind?
  2. How to associate each user with a distinct, temporary process?
  3. How to improve scalability if there are more and more users working simultaneously?
  4. If the Maxima input command entered by a user cause long-running process, what is the wise way to notify the user about the progress?

The following link provide you with more detail about my project: https://sourceforge.net/projects/aspmaxima/forums/forum/1190702/topic/3786806

Thank you in advance.

+1  A: 

You should not be using codebehind in an MVC app.

Scalability while interoprating with unmanaged code is hard. The only sane way to do this is to decompose the problem.

  • When you launch an unmanaged app, it already has its own process.
  • Multiple task flows in a service called from a web app, with monitoring? You're describing Windows Server AppFabric. Host your service with AppFabric, and you won't have to write all of this yourself.
  • Regarding scalability, when you're dealing with unmanaged processes, you're going to have to limit the number which can start concurrently. Trial and error will be necessary to determine the optimum on specific hardware.
  • You can only monitor an unmanaged task's progress if that app specifically provides for it.
  • Launching arbitrary unmanaged code from a service is dangerous, because the launched app, by default, inherits the service's (typically raised) permissions. Consider using specific, limited credentials for the launched app instead of the default.
Craig Stuntz