0

I have a requirement where in a long running process needs to be triggered from an ASP.Net page. So I decided on using an architecture where in the ASP.Net stores the required task into database and Windows service (will be pooling every 10 sec) will pick the database information and start the process. With this architecture, how can I accomplish stopping the task initially requested by ASP.Net webpage?. Example:

  1. User clicks the START button on ASP.Net page and is redirected to screen which shows the stats of the request. The user will be provided with a button as CANCEL if he wants to cancel the on going task.
  2. ASP.Net page updated the database table with appropriate data.
  3. The windows service pools the table and starts the long running process.
  4. Before the windows service completes the task, the user decided to cancel the ongoing task. How to can I make this happen?. Any idea is greatly
bp581
  • 859
  • 1
  • 16
  • 47
  • 1
    Why not do it the same way you're starting the process? Have the process poll the database and once it sees the "cancel" command, stop the process. – eddie_cat Feb 12 '15 at 19:21
  • @eddie_cat....how to make the windows service know the task name ?. – bp581 Feb 12 '15 at 19:33
  • @mason the windows service will broadcast a UDP packages. – bp581 Feb 12 '15 at 19:34
  • @bp581 You would include that information in the database table. – mason Feb 12 '15 at 19:38
  • With Task Parallel Library there is a cancellation token. See https://msdn.microsoft.com/en-us/library/dd997396(v=vs.110).aspx. – Keith Payne Feb 12 '15 at 19:40
  • I have limited knowledge on windows service and thread(need to learn for this project). So in windows service when I start the task , I can give a unique name ? which can be stored in db ?. – bp581 Feb 12 '15 at 19:41

0 Answers0