Windows Service

  • Thread starter Thread starter Kuldeep
  • Start date Start date
K

Kuldeep

Framework: Visual Studio 2005
Language: C#.NET

Hi All,

I would llike to write a Windows Service which does the follwing steps:
1. Look for any PDF files from a location
2. Collect all the PDF files and move them to another location.

This service will run in a location where our web application will be
hosted. So automatically, there would be quite a few requests which will be
invoked and there would be a case where the "CPU Utilization" of the server
will reach 100% more often than not.

How do I write a very effecient, effective Windows Service to complete the
above mentioned tasks?

Along with this, if there are some good links from where I can gather all
the information about writing good Windows Services, please share it with
me.

Thanks in advance,
Kuldeep
 
well you only really need a filesystemwatcher to check for changes to youer
location, and see if any new PDF files exist. Lots of examples around.

http://msdn2.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx

Couple that with some code to evaluate perfmon and you should be able to
determine how busy your system is to stop your file copies from happening
until more CPU is free.

http://msdn2.microsoft.com/en-us/library/aa645516(VS.71).aspx

Regards

John Timney (MVP)
http://www.johntimney.com
http://www.johntimney.com/blog
 
Back
Top