views:

69

answers:

5

Hi all,

I need to do the following and i was wondering if i could get some of your input. Every night there is a file created at a certain location (on a ftp server). What i need to do is download this file and import it into a remote sql server via web services. I also need to have the ability to re-run the import process (download file and send contents to server) at any time manually. I figured a windows service would be good for this, but i don't see how i can manually re-run the import process at any time. Has anyone done anything similar to this. If so, what was the technique you used?

Thanks

+2  A: 

The Service Controller class might be helpful to you. You can use it to execute a command within your running service from a separate "Front end" app.

Totty
A: 

You could use something like SyncBackSE to create a Profile to download your file via FTP and then run an After event to do your import (you can specific what you want to run). This can be put on a schedule (runs via Windows Scheduled Tasks), but you could also run it manually (select the Profile and then Run). Not really any programming required, I suppose this more of a server admin answer to your question.

Pauk
+4  A: 

A Windows Service is a little overkill for that, unless maybe if you want to poll every 10 minutes or something for the file. Otherwise, you should really use a Scheduled Task instead.

If you do go with a Windows Service, you can do a simple Custom Command to get it to poll. Remoting, IPC, etc. would also work - but are considerably heavier weight.

Mark Brackett
I am really new to creating scheduled tasks. Do i have to create a windows app and then have the task run it on a timer or something? Any more info on this would be helpful. Thanks
zSysop
A: 

If you want to talk to a windows service from a desktop app (to tell it to do your manual run), then the canonical way to do that is to use named pipes. They're pretty simple to implement, and pipes cross session/desktop boundaries, which is necessary when you're talking to a service.

Bob Moore
A: 

I agree that you could do this through a scheduled task. But if you really want to use a Windows service instead, you could run the program with a command-line parameter, like "MyService.exe -onetime". Then, in your Main function, you can check for if that command-line parameter was included. If it was, then you could skip the usual code and just run the import instead.

Jacob