Subsystem in a web application for periodic tasks

To be precise: I have a .NET web forms system. I need a way to check some values ​​and perform tasks depending on those values ​​in a periodic fashion. Let me tell you, every month I have to check if my clients' credit cards are valid. There are some other tasks / checks in short periods.

What is the best approach to the topic. I was thinking about Windows Service, but I was reading about WCF. Please advise what is a modern and efficient way to solve this problem. I am thinking about .NET 4.0.


source to share

4 answers

WCF is just an interface that can run on both Windows Service and IIS. You are using this WCF interface to trigger some synchronous or asynchronous actions.

In your case, it sounds like you want the Windows service to time out the validation of the data stored in a database or file.

If you want to start a process on demand, adding a WCF endpoint can be helpful, if the timer approach is good enough then you don't need to worry about WCF.

Links to host WCF in Windows Process



As you guessed it, Windows Service is a good approach to this problem.

Likewise, you can write a console application and run it using a scheduled task on Windows.

It depends on how your backend works and what you are most familiar with.

Writing a console application is very easy to do, but it is perhaps the best approach since you need to ensure that the user is logged in to complete the scheduled task.

The service is a little more difficult to implement, but it has advantages for proper integration into the OS.

MSDN has a good guide for writing a service in C # and you don't necessarily need WCF:



You can use something like See Link -



If you have limited control over the server (i.e. only regular HTTP pages are allowed):

You can also use the web page to run the task - this way you don't need any additional components installed on the server. Then for the other machine to set up periodic requests to the pages (pages) that run the tasks. Make sure the tasks are reloadable and short enough so that you can complete each request on a regular page. The page can respond with "next task to start" data so that your client page can continue pinging the server until the entire operation completes.

Note. Attempting to run long running tasks inside the web service process is unreliable due to reuse of the app / app domain.



All Articles