473,471 Members | 2,037 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Windows service

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
5 4991
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Michael Riggio | last post by:
Is there a way to have a windows service instantiate a class that is a web service, which will then be accessible to clients via HTTP? Thanks, -Mike
1
by: Artur Kowalski | last post by:
I have a NotifyIcon in my Windows Service project and I am trying to add a ContextMenu to this NotifyIcon or use some of the mouse events. Everything isn't working. I think so base class of the...
9
by: SP | last post by:
Hi All, I wrote a windows service which is supposed to stop after specified amount of time. I am calling OnStop() after specified time. OnStop() methods executed but I dont see the service...
1
by: Scott Davies | last post by:
Hi, I'm looking for some help on a small program that I'm trying to develop in VB.NET. I'm having trouble getting the code that I've written to work, can anyone shed some light as to where I'm...
0
by: Scott Davies | last post by:
Hi, I'm looking for some help on a small program that I'm trying to develop in VB.NET. The program I'm trying to develop needs to be able to do the following: - Select remote server -...
3
by: Doug Bailey | last post by:
I am trying to control a Windows Service via a Web Service interface. (I am developing in .NET2003) I am using the ServiceController object which allows me to read the state of the services with...
2
by: deko | last post by:
When to use a privileged user thread rather than a windows service? That's the question raised in a previous post . It was suggested that if the service needs to interact with a WinForms app...
4
by: tshad | last post by:
What would be a good way to check programmatically whether a service was running? We have a service that dies periodically and I need to check to see if this service is running. I know how to...
5
by: dm3281 | last post by:
I'm really starting to hate writing services -- or trying to, anyway. Why do I need to rename my project to the service name? Why do I need to set the "ServiceName" property to my service name?...
1
by: =?Utf-8?B?TWFuanJlZSBHYXJn?= | last post by:
Hi, I created a web service that I want to host in windows service. The problem is that if I host it as windows service it does not use the configuration file. I have to define the binding,...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.