none
Problem with FileSystemWatcher on 2003 server box RRS feed

  • Question

  • Hello everyone,

     

    I'm not sure if I'm posting this in the right areas or not so I apologize if it's in the wrong place. But, I have developed a Windows service that uses the FileSystemWatcher to be notified when files are written to a given directory structure. The service works wonderfully on my development box which is Windows XP and another user's machine that is also XP. The problem I am having is that when I deploy this service to our server (2003 server) I am losing a lot of the events...When I say losing I mean the File Watcher is throwing an error that contains no information in the inner exception, and has a message of:

    "System.ComponentModel.Win32Exception: The specified server cannot perform the requested operation."

    I have checked into permissions (The credentials used with the service have full read/write) to no avail and the service on my local box is running under the same log in credentials. I have access to try this on a 2008 machine, but I'm hoping someone out there can give me an idea as to why it will not run properly on 2003.

    Monday, June 13, 2011 8:50 PM

All replies

  • I assume the directory you're watching is a mapped network drive? What happens if you log in on the server and try to browse to the same directory?

    I suspect this isn't related to programming at all. This issue has been reported by people after installing Microsoft Hotfix MS05-011. One possible solution is to uninstall that hotfix from the server. Unfortunately that opens the doors for the old vulnerability. Another fix is to make sure the server is up to date - install Service Pack 1 and all other hotfixes and updates. People who have had this problem report that SP1 fixes the issue without having to uninstall the hotfix.

    Monday, June 13, 2011 9:20 PM
  • Check Service Logon Account.

    http://msdn.microsoft.com/en-us/library/ms677948(VS.85).aspx

    chanmm


    chanmm
    Tuesday, June 14, 2011 4:35 AM
  • Hey Tim,

    It is a network path that I am hitting using UNC. The server sees the directory just fine, in fact 90% of the time the FSW events are being fired properly...It's just that 5-10% that I am getting that error with nothing in the inner exception.

    Tuesday, June 14, 2011 3:32 PM
  • Hey Chanmm,

    The logon account has full permissions on the server it is installed on as well as to the server that holds the files I am trying to view. This is verified by the fact that 90% of the events are seen and processed properly. On the XP box (same logon credentials pointed to same file server) It gets every single event without erroring. I was hoping this was something somebody else had seen on the 2003 servers...I've seen other people note the same problem but nobody has ever been able to come up with an answer.

    Thanks!

    Tuesday, June 14, 2011 3:36 PM
  • Hi

    The error message "the specified server cannot perform the requested operation" means you requested an operation that cannot be performed by the specified server.

    Make sure you have specified the correct computer name and command, then retry the command. If you continue to have problems, contact your network administrator.

    http://msdn.microsoft.com/en-us/library/ms837602.aspx

    This may be a existing issue. Someone has the similar problem.

    http://social.msdn.microsoft.com/forums/en-US/netfxbcl/thread/9a92c616-4c30-47df-9dda-dc08e6fafec4

    You may monitor the issue here.

    http://connect.microsoft.com/VisualStudio/feedback/details/337917/filesystemwatcher-not-firing-events-for-monitored-network-drive

    Hope this can help you.

     


    Cookie Luo[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, June 16, 2011 2:52 AM
  • Hi Rytra,

    How about your issue now?


    Cookie Luo[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, June 20, 2011 3:26 AM
  • Hey Cookie,

    No resolution as of now. I have a couple more data points and have noticed a couple more things though. First, this is pointed to a Samba share. Second, I have noticed that most of the time the event is recorded properly but it also throws the listed exception. So, the crux of the problem looks like it is in the rename event. I did have our SA look at permissions and the service log on accounts and everything has full permissions on both the application server and the file server. Again, this works about 90% of the time even on the 2003 server (other than it throws the exception every time the rename event is fired on 2003) and it works 100% of the time from my XP box.

    So, I've come to this...90% success may be ok since I am going to run a polling service every 10 minutes or so that goes through and cleans up any files that were not picked up by the FSW. I'm very open to any fixes to this as I'd like to get it working properly, but I do have a workaround that seems to be sufficient for what we need to do. btw, I also tried this on one of our 2008 servers and got the same results as 2003.

    Thanks,

    ryan

    Monday, June 20, 2011 6:49 PM
  • Hi

    This may be an issue.

    I find a similar problem at Microsoft Connect.

    http://connect.microsoft.com/VisualStudio/feedback/details/96636/filesystemwatcher-missing-events-on-windows-terminal-services-with-minimized-window

    Please feed back this issue to Connect web site.

    http://connect.microsoft.com/

    Thanks for your understanding. 


    Cookie Luo[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, June 23, 2011 1:48 AM