Re: Windows Service



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



.



Relevant Pages

  • Accessing a windows Service from a web form
    ... I have written a web-service which runs on a timer to check for data in a ... database from web, telephone and Windows applications. ... versions of the same code I wrote it once in a windows service which happens ... for the timer. ...
    (microsoft.public.dotnet.framework.aspnet)
  • RE: Connection error SQLSetConnectAttr failed
    ... I don't think I've ever seen machine and database names be numeric values. ... DSN when you created it. ... | I have an undocumented ODBC driver..Or the supplier at least won't give ... and would prefer to do it via windows service. ...
    (microsoft.public.data.odbc)
  • Re: Windows Service
    ... Notifications of table updates (i.e. SQL Server). ... You said that the database is outside your domain, ... My Windows service ... | trigger, but I've been told that it's possible to do thing this way. ...
    (microsoft.public.dotnet.general)
  • Re: Shutdown abort: could not shutdown the database....
    ... time-out in LISTEN while waiting for a message ... I wanted to restart the database. ... Windows Service was up, so I ... I rebooted Windows Server and everything started working. ...
    (comp.databases.oracle.server)
  • Windows Service
    ... I have a database table, changes to the data within which I am interested in ... Within my domain is the design of a Windows service to perform the ... This involves contacting web services ... introducing problems into our system due to my lack of experience. ...
    (microsoft.public.dotnet.general)

Quantcast