Re: Windows Service
- From: "Kevin Spencer" <unclechutney@xxxxxxxxxxxx>
- Date: Wed, 25 Apr 2007 06:52:35 -0400
1. Are there any issues with this approach that anyone would care to draw
to my attention?
Rather than using a timer, use a FileSystemWatcher class, which can watch
the file and raise an event when it changes. A FileSystemWatcher simply
subscribes to file system events.
Also, make sure to implement safeguards that will prevent the service from
stopping when an exception occurs. A Windows Service runs unattended, so it
must be very robust. You may want to implement some kind of alert system for
the service when an exception occurs as well. We have, for example, a
service that sends an email to me when an exception occurs.
2. Since it is conceivable that more than one record has changed in the
database, should I perform my operations on each record concurrently using
different threads?
I don't follow you. You said that the database is outside your domain, and
didn't mention more than one file. In addition, you said that the database
would update "a file," which doesn't make sense. A database can update a
table, but not a file.
3. Given my lack of experience with Windows services, are there any
specific areas that anyone would recommend I study up on before
proceeding?
Debugging Windows Services is difficult. Our approach is to put the
functionality for the service into a class library, which we can test using
a Windows Forms user interface. Then you can host the class(es) in your
Service once you're sure they are working correctly.
--
HTH,
Kevin Spencer
Microsoft MVP
Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
"Chris Marsh" <cjm@xxxxxxxxxxxxxxxx> wrote in message
news:%2367ZbgxhHHA.3412@xxxxxxxxxxxxxxxxxxxxxxx
All
I have a database table, changes to the data within which I am interested
in acting on. The approach that I'm taking is to have the database update
a file every time data is updated. This process is outside my domain - I
can rely on the file being updated when data changes.
Within my domain is the design of a Windows service to perform the
operations required when the data changes. I have not produced a Windows
service before (being mostly a web application .NET developer), but the
process seems fairly straightforward. My Windows service will poll the
file (using a Timer object), and when the file has been updated the
Windows service will access the database, fetch the data that has changed,
and perform the required operations on it. This involves contacting web
services provided by a different system.
My questions are as follows:
1. Are there any issues with this approach that anyone would care to draw
to my attention?
2. Since it is conceivable that more than one record has changed in the
database, should I perform my operations on each record concurrently using
different threads?
3. Given my lack of experience with Windows services, are there any
specific areas that anyone would recommend I study up on before
proceeding?
I realise that these questions are fairly open ended, but I'm wary about
introducing problems into our system due to my lack of experience. I want
to ensure that I don't produce a subsystem that *appears* to work, but
introduces subtle problems at a later date that are perhaps difficult to
pick up immediately.
Any comments are appreciated; many thanks in advance one and all!
--
Regards
Chris Marsh
.
- Follow-Ups:
- Re: Windows Service
- From: Chris Marsh
- Re: Windows Service
- References:
- Windows Service
- From: Chris Marsh
- Windows Service
- Prev by Date: Re: Treeview Menu in asp .net 1.0
- Next by Date: Cannot add AxWindowsMediaPlayer object to toolbox in VS 2005 SP1 under Vista
- Previous by thread: Windows Service
- Next by thread: Re: Windows Service
- Index(es):
Relevant Pages
|