views:

73

answers:

4

I have a data loading application that has to be executed multiple times per day at irregular intervals. I am planning to write a service to kick off the downloads and import the data to a database server. Are there advantages to using a standard service over a webservice or vice versa?

+7  A: 

I think you're missing the point here.

Web Services typically are used for a form of communication or remote execution. You call a remote function on a web-service to either adjust the behavior of the machine it's running on or to retrieve data from it.

Windows Services are background processes that run on a machine without any "logged on user" being required. They can perform tasks and do things while the user is at the login screen, or do elevated operations. You can talk to services to adjust their behavior or retrieve information, but it's general purpose is different than a webservice.

The biggest notable difference here is that web-services must be called, they don't run on their own.

For your application I would suggest using a Windows (Standard) Service, as you can have it execute code once per day. I would only use a web-service if you've got something else to automate the calls to the web-service and you require a response from the server detailing it's execution result (success/fail/warning/etc...)

Aren
+1  A: 

If "irregular interval" does mean, the application is invoked by another application, I would use a web service.

If the action is scheduled, I would use a windows service.

If you are working with SQL Server (scheduled or not), I would also consider SQL Server Integration Services.

Greets Flo

Florian Reischl
+1  A: 

You could also consider writing a normal (windows or console) application that is triggered by a Windows Scheduled Task. What you've described doesn't necessarily sound like something that would require a service.

Jason
+1  A: 

Sounds like a good use of a windows service to me. Off the top of my head, I'd use a windows service if: 1. Work is performed on a scheduled basis (regular or irregular intervals) in the background; 2. No interaction is needed - work is just done in the background and kicks off based on polling or some other type of trigger (message dropped in queue, database value trigger, scheduled timespan, etc.); 3. Needs to be monitored (either starts/stops along with logging) and you can take advantage of WMI, perfmon and event log with little effort.

A web service is better for tasks that are interactive (like if you wanted to initiate the download based upon a request received).

Sounds like a windows service is the approach you should take.

Hope this helps. Good luck!

David Hoerster