简体   繁体   English

FileSystem监视程序路径不起作用

[英]FileSystem watcher path is not working

I have created C# windows service to monitor the active directory password changes. 我创建了C#Windows服务来监视活动目录密码的更改。 Whenever password changes, the service will call a webservice and return result. 只要更改密码,该服务就会调用Web服务并返回结果。 If service returns not returns success, the filewatcher directry create a textfile for the that; 如果服务返回未返回成功,则filewatcher指令将为该文本创建一个文本文件; otherwise not. 否则没有。 When service starts, if there is any pending request, it will process. 服务启动时,如果有任何待处理的请求,它将处理。

//Whenever file created... Synchronize the pending requests. When active direcory changes occur it will create files. If request is suucessfull delte the created file otherwise not

When I change the `path. 当我改变`路径。 The Filewatchercreated event is not firing. Filewatchercreated事件未触发。 Like changing passwords with any other name Data or something like that. 就像用其他任何名称Data或类似的方式更改密码。 If anyone can please help me to fix the issue. 如果有人可以,请帮助我解决此问题。

Did you remember to set the notify filters somewhere? 您还记得在某处设置通知过滤器吗?

I can't see where your creating the watcher but It could be that: 我看不到您在哪里创建观察程序,但可能是这样的:

NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.LastAccess | NotifyFilters.Attributes;

with all of the annoying issues I have had over the past with the filewatcher, like this one, I have done away with it in all of my code and gone back to the trusty old timer and poll the directory. 与过去使用filewatcher遇到的所有烦人的问题一样,我已经在所有代码中都删除了它,然后回到值得信赖的旧计时器并轮询目录。 It's worked 100% of the time for me and picks p the files when the service was not running. 对我来说,这是100%的时间,并且在服务未运行时选择p个文件。 I hope that helps. 希望对您有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM