Simple Windows Service Vs

Let me give everyone a background before I move on to my problem. My company hosts a site for many clients, my company also signs a contract with another company. Therefore, when we first created a site with all the information for our customers, we transfer this information to another company with which we have a contract, and three of us have the same data. The problem is that the site has already been launched, our customers will change some data, and when they do, we can update our contract company. The method of transferring data from a contract company is to use a web service (httppost, xml data). Now my question is, what is the best way to write a program that sends updated data to a contract company every time our customers change some data.

1) Write a Windows service with a timer inside my code, where every 30 minutes or so it connects to the database and finds all the changes and sends them to the contract company 2) Write the same code as # 1 (without a timer in it), but this time make it a simple program and let Windows Scheduler wake it up every 30 minutes 3) Any other suggestion you may have

Technologies available to me are VS 2008, SQLServer 2005

+2
source share
5 answers

A planned task is the way to go. John wrote a good summary about why services are not very suitable for this kind of thing: http://weblogs.asp.net/jgalloway/archive/2005/10/24/428303.aspx

+2
source

The service is easy to create and install, and it’s a more “professional” feeling, so why not go like that? Using a non-exe service will also work, and it will be a little easier to get work (permissions, etc.), but I think the difference in setting between them is almost negligible.

+1
source

One possible solution would be to add a timestamp column to your data tables.

Once this is done, you can have one entry in each table that has the most recent time received by your contract company. They can pull out all records from this last time and update their records accordingly.

0
source

The Windows service is more autonomous, and you can easily configure it to start automatically when the OS starts. You may also need to create additional configuration parameters, as well as somehow start synchronization right away. It will also give you more options to expand your functionality for service in the future.

A standalone application should be easier to develop, although you rely on a window scheduler to always complete the task. My experience is that it’s easiest to confuse things with the window scheduler and not start it, for example, in cases where you restart the OS, but no user is logged in.

If you need a more professional approach to the service, although this may mean a little more work.

0
source

In this case, the Windows service makes more sense. Think about what happens after the server reboots:

In a Windows application, you need someone to restart the application or manually copy the shortcut to the startup folder to make sure the application is running.

OR,

Using the Windows service, you set it to start automatically and forget about it. When the computer restarts, your service starts and continues processing.

Another consideration, what happens when there is an error? A Windows application is likely to display an error dialog box and wait for input to continue; while the service will log the error in the event log and continue.

0
source

All Articles