I've attempted to write a windows service that creates one FileSystemWatch er
for each entry in a XML config file. Everything start perfrectly and runs
as I expect for about 5 minutes and then after that the FileSystemWatch ers
seem to stop monitoring... My theory is that for some reason the Garbage
Collector is trashing my FileSystemWatch ers.
Another clue to my situation is that I just took my service and made it into
a windows form application and it's been running overnight without any
problems. What am I overlooking? Can anyone point me in the right
direction?
Thanks,
Craig 3 7840
Craig,
I have been using watcher in windows service. Sometimes when you start a
program from the watching event and that program breaks, the whole watcher
service appear to break. If you attach the debugger to windows service, you
would find out that the main window service thread would be stuck in some
other part of program, thus ignoring further watcher interrupts. To make
sure all watcher events are always handled, I write a very small process
which just pushes the required info in SQL Server table and relinquish the
control back to listener. The time consuming main program then looks in the
SQL Server table, pops off the watcher generated rows, and process them at
its Owen convenience reducing the risk of overlooking watcher event.
Fakher Halim
"Craig Thompson >" <cthompson@trcs olutions<NO Spam> wrote in message
news:OY******** ******@TK2MSFTN GP09.phx.gbl... I've attempted to write a windows service that creates one
FileSystemWatch er for each entry in a XML config file. Everything start perfrectly and runs as I expect for about 5 minutes and then after that the FileSystemWatch ers seem to stop monitoring... My theory is that for some reason the Garbage Collector is trashing my FileSystemWatch ers.
Another clue to my situation is that I just took my service and made it
into a windows form application and it's been running overnight without any problems. What am I overlooking? Can anyone point me in the right direction?
Thanks,
Craig
Fakher,
Thanks for the response and the advice. I'll give it a shot...
Craig
"Fakher Halim" <fa****@msn.com > wrote in message
news:Oo******** ******@TK2MSFTN GP11.phx.gbl... Craig, I have been using watcher in windows service. Sometimes when you start a program from the watching event and that program breaks, the whole watcher service appear to break. If you attach the debugger to windows service,
you would find out that the main window service thread would be stuck in some other part of program, thus ignoring further watcher interrupts. To make sure all watcher events are always handled, I write a very small process which just pushes the required info in SQL Server table and relinquish the control back to listener. The time consuming main program then looks in
the SQL Server table, pops off the watcher generated rows, and process them at its Owen convenience reducing the risk of overlooking watcher event.
Fakher Halim
"Craig Thompson >" <cthompson@trcs olutions<NO Spam> wrote in message news:OY******** ******@TK2MSFTN GP09.phx.gbl... I've attempted to write a windows service that creates one FileSystemWatch er for each entry in a XML config file. Everything start perfrectly and
runs as I expect for about 5 minutes and then after that the
FileSystemWatch ers seem to stop monitoring... My theory is that for some reason the
Garbage Collector is trashing my FileSystemWatch ers.
Another clue to my situation is that I just took my service and made it into a windows form application and it's been running overnight without any problems. What am I overlooking? Can anyone point me in the right direction?
Thanks,
Craig
Just to follow-up for anyone who runs into this problem in the future...
Fakher's suggestion worked. I changed my service to only execute a stored
procedure that writes a record to a SQL table when a FileSystemWatch er event
is triggered. Then periodically, I have another thread on the service that
looks at this table for new files to process. This seems to have freed up
the FileSystemWatch er thread and my service does not mysteriously stop
anymore...
Craig
"Craig Thompson >" <cthompson@trcs olutions<NO Spam> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. .. Fakher, Thanks for the response and the advice. I'll give it a shot... Craig
"Fakher Halim" <fa****@msn.com > wrote in message news:Oo******** ******@TK2MSFTN GP11.phx.gbl... Craig, I have been using watcher in windows service. Sometimes when you start a program from the watching event and that program breaks, the whole
watcher service appear to break. If you attach the debugger to windows service, you would find out that the main window service thread would be stuck in
some other part of program, thus ignoring further watcher interrupts. To make sure all watcher events are always handled, I write a very small process which just pushes the required info in SQL Server table and relinquish
the control back to listener. The time consuming main program then looks in the SQL Server table, pops off the watcher generated rows, and process them
at its Owen convenience reducing the risk of overlooking watcher event.
Fakher Halim
"Craig Thompson >" <cthompson@trcs olutions<NO Spam> wrote in message news:OY******** ******@TK2MSFTN GP09.phx.gbl... I've attempted to write a windows service that creates one FileSystemWatch er for each entry in a XML config file. Everything start perfrectly and runs as I expect for about 5 minutes and then after that the FileSystemWatch ers seem to stop monitoring... My theory is that for some reason the Garbage Collector is trashing my FileSystemWatch ers.
Another clue to my situation is that I just took my service and made
it into a windows form application and it's been running overnight without any problems. What am I overlooking? Can anyone point me in the right direction?
Thanks,
Craig
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Lloyd Sheen |
last post by:
I have created a FileSystemWatcher application that monitors a set of folder
for changes. This works well as a windows app. I have copied the code from
the windows app to a windows service and now there are problems.
If I perform add/chg/del in the folder, the windows app captures all changes
(actually to a degree that I did not know happened - ie. 4 events for an add
of a file).
The windows service though will not pick up add's to...
|
by: Rich Miller |
last post by:
Previously posted on the VB newsgroup with no replies, so any ideas
appreciated. I have written a service application in VB (VS.Net 2003). On
start, the service creates an object that instantiates a
System.IO.FileSystemWatcher like so (the _watcher is
declared at the class level as Private and no WithEvents):
' construct the file watcher
_watcher = New FileSystemWatcher
_watcher.Path = WatchPath
_watcher.NotifyFilter =...
|
by: Jet Leung |
last post by:
Hi all,
I had made a program to watching files in my directory. I had used a
instance of FileSystemWatcher to do my work.And I had add some events of the
FileSystemWatcher , for example onChange, onRename and so on.
And I had made this program as a windows service.As I know, if I delete a
file from my directory, this behavior will active this program and do
something what I want to do. But after I install this program as a windows
service...
|
by: Bonnett |
last post by:
I have made a simple console application that creates a webpage from my
playlist, then uploads it to my webhost. I decided to convert it to a
windows service and use the FileSystemWatcher to monitor the playlist file,
this is where i became stuck. I know the service detects changes to the
playlist as when running the Change event of FileSystemWatcher, I add an
item to the event log. I've tried making the service without including the...
|
by: Phil396 |
last post by:
I have a windows service that uses a filesystemwatcher
to wait for files and process them to a database.
Sometimes a large group of files will be cut and paste
for the filesystemwatcher to process. I ran into
trouble when trying to process a group of files
at a time.
The code below fixed my problem for about 15 large files
( around 100k each ). However when I tried to use it
on a group of small files ( 90 files ) it crashes (
around 6k...
| |
by: Sacha Korell |
last post by:
I need to set up a FileSystemWatcher in my web application (to automatically
process uploaded files) and I'm trying to decide where to set it up. I would
like to keep it within the web app, but it needs to watch a certain folder
even when nobody is making a request. I could instatiate the
FileSystemWatcher in the Application_Start event, but what happens when
somebody restarts the server? I guess in that case the FileSystemWatcher
wouldn't...
|
by: J-T |
last post by:
We are working on an asp.net application which is a 3-tier application.I was
aksed to create a component which monitors a folder and gets the file and
pass them to a class library in our business logic layer(so far so good and
easy).I initialize my class which is using a FileSystemWatcher in my
Global.asax and everything works fine.I have found FileSystemWatcher class
not very reliable and sometimes it behavies unexpectedly.I'm afriad that...
|
by: Rich Miller |
last post by:
Any ideas appreciated. I have written a service application in VB
(VS.Net 2003). On start, the service creates an object that
instantiates a System.IO.FileSystemWatcher like so (the _watcher is
declared at the class level as Private and no WithEvents):
' construct the file watcher
_watcher = New FileSystemWatcher
_watcher.Path = WatchPath
_watcher.NotifyFilter = (NotifyFilters.FileName Or NotifyFilters.Size
Or...
|
by: D2 |
last post by:
Hi,
We are using FileSystemWatcher class in a windows service to monitor a
directory "d:\abc". This path is configured in a config file. When the
service is running and FSW is watching this directory, user is able to
open up Windows Explorer and rename d:\abc to d:\xyz.
The problem here is, FSW doesnt fire any event for this hence my
program doesnt know that the monitored folder has been renamed. Next
time the service is started, it...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
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 we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |