By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,569 Members | 1,338 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,569 IT Pros & Developers. It's quick & easy.

Windows service

P: n/a
Hi all

I need to create a windows service that will wait for a file to be
copied somewhere, write it to the database, and then move the file to
a storage area.

I don't know when the file will come in, so I think I need a service
vs using task scheduler.

Am I correct? If yes, can someone help with how to do this? So far
I've figured out that I probably need a service, and I've gone through
actually creating the service, but how do I call my function that will
do the file check and read from the service?

Thanks in advance for any help

Belsam
Nov 13 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Hi,

You can use a windows service for this and use a FilSystemWatcher instance
to "watch" the directory for the required file. I have a service running
like this with no problem, just let me know if you want some code.
Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Belsam" <be******@yahoo.com> wrote in message
news:47**************************@posting.google.c om...
Hi all

I need to create a windows service that will wait for a file to be
copied somewhere, write it to the database, and then move the file to
a storage area.

I don't know when the file will come in, so I think I need a service
vs using task scheduler.

Am I correct? If yes, can someone help with how to do this? So far
I've figured out that I probably need a service, and I've gone through
actually creating the service, but how do I call my function that will
do the file check and read from the service?

Thanks in advance for any help

Belsam

Nov 13 '05 #2

P: n/a
The Watcher is great, but it doesn't eliminate the need of periodical
polling. If the file arrival directory is on the network, than, in case if
the network goes down, and a new file arrives in this time, no notification
on the new file will come when the network goes up. Furthermore, my service,
equipped with both Watcher and polling, still misses files by some customers
due to failure to reconnect to the network after remote server re-boot. In
other words, if files arrive to the directory located on another server, and
the another server reboots, my service needs to be re-started. I guess there
is something in network environment that causes this.

Anyway, the bottom line is that the Watcher alone is not enough if the files
arrive to a remote directory.

Eliyahu

"Ignacio Machin" <ignacio.machin AT dot.state.fl.us> wrote in message
news:eO**************@TK2MSFTNGP10.phx.gbl...
Hi,

You can use a windows service for this and use a FilSystemWatcher instance to "watch" the directory for the required file. I have a service running
like this with no problem, just let me know if you want some code.
Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Belsam" <be******@yahoo.com> wrote in message
news:47**************************@posting.google.c om...
Hi all

I need to create a windows service that will wait for a file to be
copied somewhere, write it to the database, and then move the file to
a storage area.

I don't know when the file will come in, so I think I need a service
vs using task scheduler.

Am I correct? If yes, can someone help with how to do this? So far
I've figured out that I probably need a service, and I've gone through
actually creating the service, but how do I call my function that will
do the file check and read from the service?

Thanks in advance for any help

Belsam


Nov 13 '05 #3

P: n/a
This sound like more of a bug in the Watcher than a general problem related
to using them. The Watcher Notification mechanism should have the smarts to
take care of this and any other conditions. Perhaps you should report this
as a bug instead of (or in addition to) working around it.
You shouldn't have to know anything about local/remote issues and polling is
definitely unnecessary for a system service of this type.

Oscar.

"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:eu**************@tk2msftngp13.phx.gbl...
The Watcher is great, but it doesn't eliminate the need of periodical
polling. If the file arrival directory is on the network, than, in case if
the network goes down, and a new file arrives in this time, no notification on the new file will come when the network goes up. Furthermore, my service, equipped with both Watcher and polling, still misses files by some customers due to failure to reconnect to the network after remote server re-boot. In
other words, if files arrive to the directory located on another server, and the another server reboots, my service needs to be re-started. I guess there is something in network environment that causes this.

Anyway, the bottom line is that the Watcher alone is not enough if the files arrive to a remote directory.

Nov 13 '05 #4

P: n/a
It would have been very nice to have a component like this, but I don't
think it is possible to anticipate all sorts of network behavior for all
sorts of network. So I have no complains to Microsoft on this. It looks to
me that another solution is more feasible. That is when you have a network
guru who can setup the network is the way suitable for the Watcher.

Eliyahu

"Oscar Papel" <oe*****@rogers.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
This sound like more of a bug in the Watcher than a general problem related to using them. The Watcher Notification mechanism should have the smarts to take care of this and any other conditions. Perhaps you should report this as a bug instead of (or in addition to) working around it.
You shouldn't have to know anything about local/remote issues and polling is definitely unnecessary for a system service of this type.

Oscar.

"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:eu**************@tk2msftngp13.phx.gbl...
The Watcher is great, but it doesn't eliminate the need of periodical
polling. If the file arrival directory is on the network, than, in case if the network goes down, and a new file arrives in this time, no

notification
on the new file will come when the network goes up. Furthermore, my

service,
equipped with both Watcher and polling, still misses files by some

customers
due to failure to reconnect to the network after remote server re-boot. In other words, if files arrive to the directory located on another server,

and
the another server reboots, my service needs to be re-started. I guess

there
is something in network environment that causes this.

Anyway, the bottom line is that the Watcher alone is not enough if the

files
arrive to a remote directory.


Nov 13 '05 #5

P: n/a
Why are you apologizing on behalf of Microsoft?
This type of control is useless if you also have to poll.
The point of the control is to avoid polling.
If it doesn't do that then it needs to be (or at least it should be)
modified.
Otherwise there is no point in using it at all.

It's not that hard to fix it either.
When the network goes down, on first reconnection, generate some
notifications.
Or better yet, issue a composite notification that says "rescan
subdirectory"

The control is in a better position than you are to know what is going on
from a network perspective anyway.

Oscar.

"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:#2**************@TK2MSFTNGP10.phx.gbl...
It would have been very nice to have a component like this, but I don't
think it is possible to anticipate all sorts of network behavior for all
sorts of network. So I have no complains to Microsoft on this. It looks to
me that another solution is more feasible. That is when you have a network
guru who can setup the network is the way suitable for the Watcher.

Eliyahu

"Oscar Papel" <oe*****@rogers.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
This sound like more of a bug in the Watcher than a general problem related
to using them. The Watcher Notification mechanism should have the smarts to
take care of this and any other conditions. Perhaps you should report this
as a bug instead of (or in addition to) working around it.
You shouldn't have to know anything about local/remote issues and polling is
definitely unnecessary for a system service of this type.

Oscar.

"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:eu**************@tk2msftngp13.phx.gbl...
The Watcher is great, but it doesn't eliminate the need of periodical
polling. If the file arrival directory is on the network, than, in
case if the network goes down, and a new file arrives in this time, no notification
on the new file will come when the network goes up. Furthermore, my

service,
equipped with both Watcher and polling, still misses files by some

customers
due to failure to reconnect to the network after remote server
re-boot. In other words, if files arrive to the directory located on another

server, and
the another server reboots, my service needs to be re-started. I guess

there
is something in network environment that causes this.

Anyway, the bottom line is that the Watcher alone is not enough if the

files
arrive to a remote directory.



Nov 13 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.