473,396 Members | 1,847 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Working with windows service in c#

R A
Hi

I have created a windows service. I need the service to monitor some file
status for any changes in the file size. How can I have the service execute
the monitor function lets say every 10 seconds? do I need to create a
seperate thread for that? I can't use the service events such as OnStart and
others because they are events and I want to constantly monitor the file
size.

Thnaks,
Ron
Nov 15 '05 #1
3 7107
You can use a FileSystemWatcher for this.
This will notify u when your file has changed.

Greetz,
-- Rob.

R A wrote:
Hi

I have created a windows service. I need the service to monitor some
file status for any changes in the file size. How can I have the
service execute the monitor function lets say every 10 seconds? do I
need to create a seperate thread for that? I can't use the service
events such as OnStart and others because they are events and I want
to constantly monitor the file size.

Thnaks,
Ron

Nov 15 '05 #2
R A
Well the service needs to monitor other things also. Is there a way to
constantly process information in the service beside using its events.
Ron

"Rob Tillie" <Ro********@student.tul.edu> wrote in message
news:eM**************@TK2MSFTNGP09.phx.gbl...
You can use a FileSystemWatcher for this.
This will notify u when your file has changed.

Greetz,
-- Rob.

R A wrote:
Hi

I have created a windows service. I need the service to monitor some
file status for any changes in the file size. How can I have the
service execute the monitor function lets say every 10 seconds? do I
need to create a seperate thread for that? I can't use the service
events such as OnStart and others because they are events and I want
to constantly monitor the file size.

Thnaks,
Ron


Nov 15 '05 #3
Ron,

Basically, what you would do is have a timer that you spawn in the
OnStart method. Once you have that, you can check the file every time the
event fires.

I am curious though, why not instantate a FileSystemMonitor instance and
use that?

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"R A" <ro****@hotmail.com> wrote in message
news:uC*************@tk2msftngp13.phx.gbl...
Hi

I have created a windows service. I need the service to monitor some file
status for any changes in the file size. How can I have the service execute the monitor function lets say every 10 seconds? do I need to create a
seperate thread for that? I can't use the service events such as OnStart and others because they are events and I want to constantly monitor the file
size.

Thnaks,
Ron

Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: J. Hill | last post by:
I have a Windows Service with a timer but the .Tick event is not being fired/called. Don't know what code to include...I enabled and started the timer...I have the exact same code in a Windows...
11
by: tshad | last post by:
I have a W2003 server running my website and I am trying to set up my pages to send email using System.Web.Mail. I have pages running on this machine using CDONTS that work fine. I am using...
6
by: acool | last post by:
I managed to get my VB.NET service installed. Now I can't get it to do anything. Tell me how do you debug smething like this if you have to manually install the assembly to run it? the same code...
9
by: MSDNAndi | last post by:
Hi, I have a set of simple webservices calls that worked fine using .NET Framework 1.0. I am calling a Java/Apache based webservices, the calling side is not able to supply a proper WSDL. ...
2
by: Trevor | last post by:
Argh! This problem is driving me nuts! Can you help? In November of 2003, I installed a web service on Windows Server 2003 built in VB.NET for v1.1.4322 of the framework. It contains a timer...
1
by: las | last post by:
I have created a web service and a simple ASP.Net page that makes calls to the web service (the page roughly mimics the standard Visual Studio web service test page). Running on //localhost, if...
9
by: JT | last post by:
Here is the overall structure I will be referring to: End-program ProvideWorkFlow.dll Forms and methods that properly manipulate calls to methods in AccessUtils AccessUtils (a web service)...
1
by: chitra g | last post by:
Hi, I tried all the options below but did not work. Your suggestions please.
7
by: Daniele Piccinini | last post by:
Hallo, I've writed a C# windows service in VS 2003. This service use a System.Timers.Timer to periodically call some functions of a web service. ( Some of this functions required minutes to be...
0
NeoPa
by: NeoPa | last post by:
Introduction : I have come across a problem, on a number of occasions, where PCs under my control fail to load new updates successfully. This is true whether they are attempting to apply via the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
0
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...

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.