RaiseEvent

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MMBBRWD
    New Member
    • Sep 2008
    • 1

    RaiseEvent

    Hi,

    I am developing a windows service which uses the FileSystemWatch er to poll a known location for the arrival of files. Upon arrival the files are parsed, each line being converted to a new transaction object (class developed internal to the windows service). Upon iterating to the end of the file, I want to raise an event from the transaction object class up to the windows service. When I use the objects in a windows app, the event is raised and consumed correctly. Upon porting it to the windows service, the event is no longer firing. I realize that this may not have the level of detail needed to get an answer, but I need to begin a discussion somewhere.

    Thank you in advance for any help you can offer.
  • Pittaman
    New Member
    • Aug 2007
    • 20

    #2
    Hello,

    Firstly, I would suggest handling the file creation event or whatever immediatly and then do further processing on a different thread (however, maybe somebody disagrees?). This to ensure the release of the filesystemwatch er's resources as soon as possible, as it's not extremely scalable as it is.

    Which leads me to another idea. If you're monitoring to much files at once, the buffer flows over and you won't get an event per file. Also, if you're monitoring a network drive the watcher stops listening. Then, when the connection is re-established, the listener won't automatically restart listening.

    Other than that, maybe it has something to do with the threading?

    Greets.

    Comment

    • Plater
      Recognized Expert Expert
      • Apr 2007
      • 7872

      #3
      I *think* there is a way you can debug windows services (MSDN claims it works, I've never done it), perhaps you could debug and check to make sure the event is being triggered? Did you remember to attach the event handler?

      Comment

      • Pittaman
        New Member
        • Aug 2007
        • 20

        #4
        You can debug a service by attaching the debugger to the process (Tools -> Attach to Process).

        Comment

        Working...