C# executable with ASP.NET webpage to monitor status

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • alag20
    New Member
    • Apr 2007
    • 84

    C# executable with ASP.NET webpage to monitor status

    Hi Guys,
    I am working on a new project to provide some kind of monitor on a webpage. Basically i have a c# application which does task A, B....X, Y, Z.

    Now we would like to view what task it is doing / state in a web page and maybe trigger something in the application to stop all it is doing and do task T and then continue etc. Can someone guide me in the right direction?

    Thanks in advance.
  • jkmyoung
    Recognized Expert Top Contributor
    • Mar 2006
    • 2057

    #2
    Is task T interconnected to tasks A,B,C, ... Y, Z in resources, memory, other?
    It may be better to let the given task finish, and run process T before the next task completes.

    1. Are you making the monitor responsible for calling each task after the next one is done, or is a pure monitor thus far?
    2. You will have to code each of your tasks so that it is interruptable, and can be resumed. Depending on the complexity of your tasks, you may even have to temporarily roll-back, causing you to have to "Save State" at the beginning of some of the tasks, and when it is interrupted.
    3. Have your monitor send a interrupt message to the target tasks thread, causing an InterruptedExce ption. The handler for the task should catch this error, and determine why the Exception was sent. You will need to handle special cases such as the Thread finishing before the Exception is processed.

    This is a wide-reaching question and greatly depends on the complexity of your system and what you're doing with it.

    Comment

    • alag20
      New Member
      • Apr 2007
      • 84

      #3
      Thanks for your quick reply. All the tasks are mutually exclusive so it doesnt make a difference. The basic thing I would like to know to start with is if I have an exe and ASP.Net page, how can i communicate from ASP.NET to exe and get status?

      Comment

      • jkmyoung
        Recognized Expert Top Contributor
        • Mar 2006
        • 2057

        #4
        Since the monitor appears to be completely seperate from your tasks, you need to build in a method to contact the tasks within each task itself, eg some sort of monitor. Otherwise, it's not really easy to pause a task as then you could interfere with any random program's execution.
        Possible methods include: communication on some port, implementing a FileSystemWatch er, etc.

        Honestly, the systems I've worked with have had the monitor controlling the start and stop of tasks, so that the code overhead of being able to pause tasks was on the monitor itself.

        Comment

        • alag20
          New Member
          • Apr 2007
          • 84

          #5
          How about if i simplify it to say that the webpage will trigger each task. Next task can only be triggered once the previous task is completed. So keeping this in mind, what would be the best way to communicate between the webpage and the exe?

          Can you possibly give some sample code?

          Thanks in advance.

          Comment

          • alag20
            New Member
            • Apr 2007
            • 84

            #6
            Please help!!!! Any idea??

            Comment

            • jkmyoung
              Recognized Expert Top Contributor
              • Mar 2006
              • 2057

              #7
              Probably Windows messaging http://ryanfarley.com/blog/archive/2004/05/10/605.aspx

              Sockets may be useful if you're monitoring from a machine seperate from the machine running the processes.

              It's somewhat hard to find code for this.

              Comment

              Working...